iOS-UIAlertController的另类使用
2016-05-14 17:58
393 查看
先看图,意外发现很神奇的东西,最后发现……其实就是UIAlertController
![](http://img.blog.csdn.net/20160514175234394)
这个风格用的比较少
具体实现代码:
总结:因为在开发中,UIAlertController用的还是比较频繁的,还有一个就是MBProgressHUD提示框
我在项目中都是提前把他们封装起来,直接通过类方法调用,省去了很多的时间和代码量,有时间和大家分享一下。
建议大家多多封装一些工具类,有助于对代码的优化以及对封装的理解,同时也节省了不少的时间
这个风格用的比较少
具体实现代码:
- (IBAction)alertAction { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"致开发者的一封信" message:@"有了您的支持才能更好的为您服务,提供更加优质的,更加适合您的App,当然您也可以直接反馈问题给到我们" preferredStyle:(UIAlertControllerStyleAlert)]; UIAlertAction *refuseAction = [UIAlertAction actionWithTitle:@"��残忍拒绝" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) { NSLog(@"��残忍拒绝"); }]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"��好评赞赏" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) { NSLog(@"��好评赞赏"); }]; UIAlertAction *showAction = [UIAlertAction actionWithTitle:@"��我要吐槽" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) { NSLog(@"��我要吐槽"); }]; [alertController addAction:refuseAction]; [alertController addAction:okAction]; [alertController addAction:showAction]; [self presentViewController:alertController animated:YES completion:nil]; }
总结:因为在开发中,UIAlertController用的还是比较频繁的,还有一个就是MBProgressHUD提示框
我在项目中都是提前把他们封装起来,直接通过类方法调用,省去了很多的时间和代码量,有时间和大家分享一下。
建议大家多多封装一些工具类,有助于对代码的优化以及对封装的理解,同时也节省了不少的时间
相关文章推荐
- Hdu oj 1159 Common Subsequence(dp)
- MyGUI 总结1
- iOS-通过UISwitch控制摇一摇
- request_region
- UGUI定制彩色字体
- 几种UITableview自定义Cell的办法
- 【前端UI框架】EasyUI
- iOS-UIScrollView与UISegmentedControl的交互
- 单向队列queue的使用
- 347. Top K Frequent Elements
- Java:String、StringBuffer和StringBuilder的区别
- deque的用法
- 【SSH网上商城项目实战14】商城首页UI的设计
- easyui 使用随笔
- 347-m-Top K Frequent Elements
- Codeforces 667C Reberland Linguistics 【dp】
- 今天犯了一个非常low的错误❌。关于UINavigationController 和UITabBarController
- WCF学习系列二---【WCF Interview Questions – Part 2 翻译系列】
- Issue @20160514
- 查询sequence