我有一个以模态方式呈现的UIViewController。 UIViewController位于UINavigationController内。
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
saveButton = [[UIBarButtonItem alloc] initWithTitle:@"Save"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(saveButtonClicked:)];
self.navigationItem.rightBarButtonItem = saveButton;
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:(102.0/255.0) green:(20.0/255.0) blue:(11.0/255.0) alpha:1];
self.title = @"Login";
//toolbar.tintColor = [UIColor colorWithRed:(102.0/255.0) green:(20.0/255.0) blue:(11.0/255.0) alpha:1];
}
为什么我的导航栏不显示文本登录和右侧的保存按钮?
答案 0 :(得分:3)
听起来您可能正在呈现视图控制器而不是导航控制器。用于呈现您所描述的视图控制器的代码应如下所示:
MyViewController *viewController = [[MyViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self presentModalViewController:navController animated:YES];
[viewController release];
[navController release];
答案 1 :(得分:0)
在加载nib之后设置属性,但是在推送它之后你可能需要这样做。