iOS 7 自定义后退按钮在模式视图控制器消失后消失



我正在UIViewController中的UINavigationBar中添加一个自定义后退按钮,如下所示:

-(void)viewDidLoad {
  UIBarButtonItem *customBackButton = [[UIBarButtonItem alloc] initWithTitle:@" " style:UIBarButtonItemStyleBordered target:self action:@selector(navigateBack)];
  [customBackButton setBackButtonBackgroundImage:barBackBtnImg forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
  [customBackButton setBackButtonBackgroundImage:barBackBtnImgHighlighted forBarMetrics:UIBarMetricsDefault];
  self.navigationItem.backBarButtonItem = customBackButton;
}

它运行良好,直到我推送一个模态 UIViewController 并再次关闭它。发生的情况是,标准的iOS 7后退按钮绘制在我的自定义后退按钮上。

这看起来像一个iOS 7错误。知道如何解决它吗?

如果你把你的代码移动到viewWillAppear:(BOOL)animation,它应该可以工作。这有点像黑客,但它应该有效。

最新更新