导航控制器后退按钮可转到上一屏幕之前的屏幕
我想知道是否可以使用导航控制器按钮返回到上一页。现在,我已经使用此代码自定义了按钮
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:mainLib.navCountryTitle
style:UIBarButtonItemStyleBordered
target:self
action:@selector(handleBack:)];
,在“handleback”方法中,我调用了这一行
[self.navigationController popViewControllerAnimated:YES];
所以在这种情况下它将转到上一个屏幕。但是我想转到上一个屏幕之前的屏幕。
我知道我可以立即调用该屏幕,但我不想这样做,因为在每个屏幕中我都有一个后退按钮,该按钮应该转到其上一个屏幕。
I'm wondering whether it's possible to go back to 2 previous page using navigation controller button. Right now, I've custom made the button using this code
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:mainLib.navCountryTitle
style:UIBarButtonItemStyleBordered
target:self
action:@selector(handleBack:)];
And on 'handleback' method, I called this line
[self.navigationController popViewControllerAnimated:YES];
So in this case it will go to the previous screen. However I want to go to the screen before the previous screen.
I know that i can call that screen straight away, but I wouldn't want to do that because in every screen I have a back button which supposed to go to its previous screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用其推送索引弹出到特定的视图控制器。如果您知道语法,那么您可以像
我相信的那样这样做,在您的情况下,它将是第一个索引。尽管您可以再次更改索引并检查。
这里 self.navigationController.viewControllers 是推送的所有 ViewController 的数组。
希望有帮助。
You can pop to particular viewcontroller using its pushing index. If you know the syntax than you can do that like
I believe, In your case it would be 1st Index. Though you can again change index and check.
Here self.navigationController.viewControllers is the array of the all the ViewControllers pushed.
Hope it helps.