uialertcontroller问题

uialertcontroller问题

我在网上找了很多关于uialertcontroller的代码,复制过来运行都没任何反映。不知道哪里出了问题,用uialertview就没问题。请老师给个demo

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
imoocLovers 2018-07-04 13:35:55

参考代码如下:

 UIAlertController *alertontroller = [UIAlertController alertControllerWithTitle:@"Title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
 UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
 UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:nil];
    
 [alertontroller addAction:cancelAction];
 [alertontroller addAction:okAction];
    
 [self presentViewController:alertontroller animated:true completion:nil];

如果解决了你的问题,请采纳,祝学习愉快~

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师