开发者

iPhone SDK: Opening TableViewController with Navigation Bar

I'm creating my first iPhone app at the moment and it's going great, though I've come to a bump in the road. I'm trying to open up my settings view (a UITableViewController), though the navigation bar won't show up... I've successfully made the view open, just can't get the navigation bar to show up. Here's my code:

- (void)viewDidLoad {
[super viewDid开发者_运维知识库Load];

[self.navigationController setNavigationBarHidden:NO];
self.title = @"Settings";

UIBarButtonItem *saveItem = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStyleDone target:self action:nil];
self.navigationItem.rightBarButtonItem = saveItem;

[saveItem release];

}

If I'm doing something wrong, tell me.


You have to add the navigation controller as a sub view to the main view.

for example,

[window addSubview:NavigationController.view]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜