using the code below i am opening an information screen. everything works fine, the screen opens and the title is shown as i want, however i can not get the default back button title to change
how should i do it in xcode5
thanks
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"infoRegularSegue"])
{
FirstViewController *destViewController = segue.destinationViewController;
destViewController.title = NSLocalizedString(@"Information", title of information view);
//this code below does not work
destViewController.navigationItem.backBarButtonItem.title = @"test";
//ive also tried leftbuttonitem
}
}
after a lot of searching and trying various solutions on this forum, i finally got something that works which i am posting below for the benefit of others that get stuck at this point.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"infoRegularSegue"])
{
FirstViewController *destViewController = segue.destinationViewController;
destViewController.title = NSLocalizedString(@"Information", title of information view);
//here is the solution to my problem
UIBarButtonItem *backButton = [[UIBarButtonItem alloc]initWithTitle:NSLocalizedString(@"Return", returnbuttontitle) style: UIBarButtonItemStyleBordered target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.