在iPad的iOS7上,首先,我设置了一个模态视图控制器,大小为320 * 460,然后,在这个模态视图控制器中,我呈现了另一个导航视图控制器,在此之后,导航栏和工具栏的色调颜色呈现的导航控制器变成灰色。我尝试设置导航栏和工具栏的色调颜色,但它不起作用。
然后我尝试直接呈现导航控制器,然后所有色调颜色都适用于导航栏和工具栏。
我已经尝试过barTintColor
导航栏和工具栏的属性,它可以工作。
我不知道会发生什么。
Update
首先,我定义一个视图控制器:modalViewController
模态视图控制器如下所示:
if (DeviceIsPad()) // DeviceIsPad is a method defined somewhere to tell that the device is an iPad.
modaViewController.modalPresentationStyle = UIModalPresentationFormSheet;
//here self is a normal view controller
[self presentViewController:modalViewController animated:YES completion:NULL];
二、定义一个导航视图控制器:navigationController
像这样呈现导航控制器:
if (DeviceIsPad())
navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
// here self means the modalViewController mentioned above
[self presentViewController:navigationController animated:YES completion:nil];
我在 navigationController 的“viewDidLoad”方法中设置了导航栏和工具栏项目。
默认情况下,当导航视图控制器出现时,所有工具栏按钮项目(这些项目仅使用基本标题构建,例如Cancel
, OK
) 变成灰色。
同时,我也尝试过设置tintColor
of tool bar
and navigation bar
。实例方法和外观方法(例如[[UIToolBar appearance] setTintColor:[UIColor blueColor]]
)被使用。但还是不行。
然后我试图呈现navigationViewController
上面提到的与UIModalPresentationFormSheet
直接从普通视图控制器设置样式,然后导航栏和工具栏的所有tintColor都变成蓝色(系统蓝色)。