从第三个视图控制器弹出到第一个视图控制器(根视图控制器)
我正在使用一个导航栏,根据用户选择的内容推送多个视图。现在我需要从第三个控制器弹出到第一个视图控制器。应用程序弹出到第一个视图控制器,但导航项没有像第二个一样更改视图控制器但是,我需要更改 navigationItems。
我使用的代码:appdelagte.h
Bool isDelete;
@property(nonatomic)Bool isDelete;
appDelegate.mthirdViewController
@synthesize isDelete;
:
-(void)viewWillAppear:(Bool)animated {
appDelegate.isDelete=YES;
[self.navigationController popViewControllerAnimated:YES];
}
secondViewController.m
-(void)viewWillAppear:(Bool)animated {
if(appDelegate.isDelete==YES)
{
[self.navigationController popViewControllerAnimated:YES];
}
}
这里弹出到第一个视图控制器,但navigationItems没有像在第二个视图控制器中那样被更改
任何人都可以帮助我解决这个问题。提前致谢。
I am using a navigation bar on which I push several views according to what the user selects.Now I need to pop to first view controller from third controller.The applications pop to first view controller but navigationItems are not been changed as it is in second view controller but, I need to change navigationItems.
Code that I used: appdelagte.h
Bool isDelete;
@property(nonatomic)Bool isDelete;
appDelegate.m
@synthesize isDelete;
thirdViewController:
-(void)viewWillAppear:(Bool)animated {
appDelegate.isDelete=YES;
[self.navigationController popViewControllerAnimated:YES];
}
secondViewController.m
-(void)viewWillAppear:(Bool)animated {
if(appDelegate.isDelete==YES)
{
[self.navigationController popViewControllerAnimated:YES];
}
}
Here pop to first view controller but navigationItems are not being changed as it is in secon view controller
Any one help me to solve this.Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许你可以在不显示第三个 ctrl 的情况下执行此行为?就像在第二个 ctrl 中检查
if(appDelegate.isDelete==YES)
一样。May be you can do this behavior without showing third ctrl? Like do this check
if(appDelegate.isDelete==YES)
in second ctrl.