iOS --- UI系列之UIAlertController

来源:互联网 发布:c语言编译器哪个好用 编辑:程序博客网 时间:2024/06/06 12:36

UIAlertView与UIAlertController

这里有篇文章很好很全http://www.cocoachina.com/ios/20141126/10320.html


在远程推送的时候我们需要跳转到其他界面,当然也会弹出Alert来提醒用户,这是遇到的坑。Xcode Version 8.3.2 (8E2002) iOS10.3 。
在appdelegate里面跳转到别的界面
如果还是用UIAlertView和其代理方法使用

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;

在这个里面写push或者present可能不会进行跳转或遇到崩溃问题。
应该使用最新的UIAlertAction再回调里面写

UIAlertAction *ok = [UIAlertAction actionWithTitle:@"ok"                                                 style:UIAlertActionStyleDefault                                               handler:^(UIAlertAction * _Nonnull action) {                                               }];

0 0
原创粉丝点击