美文网首页
ios开发 自定义UIAleartContorller的样式

ios开发 自定义UIAleartContorller的样式

作者: 小小Q吖 | 来源:发表于2016-07-06 21:10 被阅读372次
Paste_Image.png
  • 苹果自 iOS8开始,就已经废弃了之前用于界面提醒的UIAleartView类以及UIActionSheet,取而代之的是UIAlertController以及UIAlertAction,从实际使用情况来看,苹果把之前不同类型/样式的通知实现方法进行了统一,简化了有关提醒功能的实现

UIAleartController的基本使用

一个简单的提示框:

UIAlertController *aleart = [UIAlertController aleartControllerWithTitle:@"标题" message:@"正文" preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handle:^(UIAlertAction *Nonnull action){
    //点击确定按钮时 要进行的操作可以写到这里
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" stule:(UIAlertAcrionStyleCancel) handler:^(UIAlertAction *_Nonnul action){
    //点击取消按钮时 要进行的操作可以写到这里
}];
[alert addAction:cancelAction];
[alert addAction:okAction];

转自 http://www.jianshu.com/users/684b27bc3e5c/latest_articles

相关文章

网友评论

      本文标题:ios开发 自定义UIAleartContorller的样式

      本文链接:https://www.haomeiwen.com/subject/svwkjttx.html