UINavigation controller back title is ignores previous title

旧街凉风 提交于 2019-12-11 22:06:52

问题


I would like my navigation controller to act the way that ios7 does = display the previous view title.

It doesn't always work for me

I have a SettingViewController :

- (void)viewDidLoad
{
    self.navigationItem.title = NSLocalizedStringFromTableInBundle(@"account_settings", nil,[GeneralUtil getLangBundle],nil);
    self.navigationController.navigationBar.translucent = NO;
    [super viewDidLoad];
}

When clicking on a button it opens the Profile Picture view controller like this:

UIViewController *vc = [[UIStoryboard profilePictureStoryBoard]instantiateInitialViewController];
            [self.navigationController pushViewController:vc animated:YES];

The profile picture is opened successfully but the title of the back button is Back and not the title of the Settings View controller which is Settings. What could be the problem?


回答1:


The back button changes its text in iOS 7 depending on the length of the title it needs to display.

If the name of the previous viewcontroller is too long to fit, it will instead just say 'Back'. If there's not even enough room for 'Back', it will just show the arrow.



来源:https://stackoverflow.com/questions/21329859/uinavigation-controller-back-title-is-ignores-previous-title

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!