I am new to Objective-C, can anyone tell me how to get this kind
of back button on the navi开发者_JAVA技巧gation bar, on click of that it should navigate to previous page.
It is default back button style of Navigation-based application. You can use it by selecting Navigation-based application when creating new application.
After created the application, you must set title of the view. That view title will be the title of back button. If you have no title of previous view, the back button will not appear automatically.
You can push view like this:
if (settingViewController == nil) {
settingViewController = [[SettingViewController alloc] initWithNibName:@"SettingViewController" bundle:nil];
}
[self.navigationController pushViewController:settingViewController animated:YES];
In this case, navigationController is already created by Xcode and you must prepare settingViewController(.h, .m, .xib).
Try this ..
[self.navigationController popViewControllerAnimated:YES];
it will get back to previous page ..
You can do as BoltClock had said.
and you can also set this title
go to the class where you have defined your navigation controller
and then go to the xib file..
in that in your navigation controller there is a option of navigation item select that
now go to attribute inspector and write down the title you wish to use
best of luck
精彩评论