作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有 3 个 View Controller 。第一个是从我的 Root View Controller 模态呈现的。
它们位于使用 push
从第一到第三的导航堆栈中。
我的最终 View Controller (第三个)有一个 UIAlertView
,按下 ok 后,我想放松到第一个 View Controller 。
但是,我所读到的任何关于这种展开的内容都建议使用 -(IBAction)
,这是通过 Storyboard按钮激活的系统。
我如何从第三个 View Controller 退回到第一个 View Controller ?我用过
[self performSegueWithIdentifier:segueString sender:self];
但它在尝试再次导航时使应用程序崩溃
最佳答案
所以你需要使用如下的 UIAlertView Delegate 方法,
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//Using buttonIndex you could find whether OK or CANCEL is pressed and perform your popToRootViewController call.
//Below on OK press then moving to root VC
if (buttonIndex==0)
{
//OK is pressed...
[self.navigationController popToRootViewControllerAnimated:YES];
}
else{
//CANCEL is pressed...
}
}
希望这对你有帮助。
关于ios - 如何从 UIAlertView 按钮解除 segues,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25806040/
我是一名优秀的程序员,十分优秀!