【发布时间】:2016-01-13 06:50:10
【问题描述】:
我有两个屏幕。从第一个屏幕到下一个屏幕,我在情节提要中连接push segue。现在在我的第二个屏幕中,将显示一个带有确定按钮的警报。按确定按钮后,我需要转到我的第一个屏幕
这是我的代码:
- (void)signup:(NSDictionary *)params {
if (error)
{
[PCUtilities showAlertWithTitle:@"Oops" message:error.localizedDescription cancelButtonTitle:@"ok"];
}
}
在一种方法中我有UIAlert。
下面的代码我试过了,但是不行!!
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"ok"])
{
[self.navigationController pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"AppMainNavController"] animated:YES];
}
}
AppMainNavController = 是我的导航控制器故事板 ID
【问题讨论】:
-
alertView现在已弃用,请使用UIAlertController,如此处所述:UIAlertView first deprecated IOS 9 -
使用按钮索引而不是比较字符串(标题)。
标签: ios objective-c