- 创建navigation的返回
UIImage *backButtonImage = [[UIImage imageNamed:@"返回"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationBar.backIndicatorImage = backButtonImage;
self.navigationBar.backIndicatorTransitionMaskImage = backButtonImage;
//隐藏返回按钮的文字
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:(UIBarButtonItemStylePlain) target:self action:nil];
但是,iOS在这里有个小坑:虽然返回按钮是在子ViewController上显示,但是修改的却是父ViewController的backBarButtonItem,所以我一开始将上面的代码加到子ViewController的viewWillAppear:方法中,就看不到效果。
网友评论