【发布时间】:2012-02-05 05:51:40
【问题描述】:
我正在尝试从模态视图设置 NavigationController,但我不知道如何使用界面生成器设置布局选项。这是我正在使用的代码。
//Create the view you want to present modally
UIViewController *modalView = [[UIViewController alloc] init];
//Create a new navigation stack and use it as the new RootViewController for it
UINavigationController *nav = [[UINavigationController alloc]
initWithRootViewController:modalView];
//Present the new navigation stack modally
[self presentModalViewController:nav animated:YES];
//Release
[modalView release];
[nav release];
是否可以在界面生成器中设置导航控制器的布局选项?我尝试使用
设置颜色nav.navigationBar.tintColor = [UIColor colorWithRed:128 green:0 blue:0 alpha:1];
但这会产生鲜红色而不是这种 RGB 组合应该产生的栗色。
如果我可以从界面生成器中控制 NavigationController 选项,这对我来说会容易得多,在这种设置下这可能吗?
【问题讨论】:
-
您只能在 IB 的主视图中设置导航栏的色调颜色。如果要更改视图之间的色调,则必须对其进行硬编码。
标签: iphone xcode uinavigationcontroller interface-builder modalviewcontroller