UINavigationBar question
I added a UINavigationBar to my UIView
I am trying to set its title , and its leftbar byut it failed
I use the following code
self.title = @"Edit Table ";
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonIte开发者_如何学JAVAmStyleBordered target:self action:@selector(EditTable:)];
[self.navigationItem setLeftBarButtonItem:addButton];
[super viewDidLoad];
nothing be changed , I call this uiview using
self.NodeSelection = [[NodesList alloc]initWithNibName:@"NodesList" bundle:nil];
[self presentModalViewController:self.NodeSelection animated:YES];
any suggestion please
Update
Call this View using
[self.navigationController pushViewController:self.NodeSelection animated:YES];
You can change the title of NavigationBar using this
self.navigationItem.title = @"Hello";
and For leftBarButton your code is right.
Second Update
For return to parent screen
[self.navigationController popViewControllerAnimated:YES];
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStylePlain target:self action:@selector(EditTable:)];
[self.navigationItem setLeftBarButtonItem:addButton];
[addButton release];
精彩评论