且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何判断在UINavigationControllerStack中按下后退按钮的时间

更新时间:2023-12-02 23:19:04

您可以尝试我的方式:

在ViewController中写入:

Write in your ViewController:

UIBarButtonItem *backBt = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"imageNameOfBackButton"] style:UIBarButtonItemStyleBordered target:self action:@selector(backBt_touch:)];
self.navigationItem.leftBarButtonItem = backBt;

行动方式:

- (void)backBt_touch:(id)sender {
  [self.navigationController popViewControllerAnimated:YES];
}

你必须拍一张你想要的后退按钮的照片。

You have to take a photo of back button you want.

弹出viewController时隐藏按钮的动画与iOS的动画不同!

Animation of hiding back button when viewController is popped is not the same animation of iOS!

P / s:
我从模拟器中获取它。希望它有用! :)

P/s: I've get it from simulator. Hope it useful! :)