AlertView + Block 的使用

  AlertView的使用还是很频繁的,扁平化以后似乎也不是那么丑了,但是到现在为止官方还是在用Delegate来处理点击事件,很影响程序的可读性。

如果用Block那么就会一目了然。自己本来想写一个,但是实在是太懒了(其实是不会好吧....)。

  当然,万能的Git上肯定有,轻而易举就找到了,使用方式如下

 1 [[[UIAlertView alloc]initWithTitle:@"提示" message:@"当前网络为移动网络,会产生流量费哦( •̣̣̣̣̣̥́௰•̣̣̣̣̣̥̀ ),是否观看视频?" cancelButtonItem:nil
 2                       
 3                         otherButtonItems:
 4                       [RIButtonItem itemWithLabel:@"不看了" action:^{
 5                         [SingleZHVideoPlayer prepareForReusePlayer];
 6                     }],
 7                       [RIButtonItem itemWithLabel:@"继续播" action:^{
 8                         [SingleZHVideoPlayer playContent];
 9                     }]
10                       , [RIButtonItem itemWithLabel:@"我是土豪,以后都不要烦我" action:^{
11                         //点播
12                         [SingleZHVideoPlayer playContent];
13                         [ZHAppManager sharedInstance].notAutoAlert2g = ![ZHAppManager sharedInstance].notAutoAlert2g;
14                         [[NSUserDefaults standardUserDefaults]setBool:[ZHAppManager sharedInstance].notAutoAlert2g forKey:isNotAutoAlert2gKey];
15                         
16                     }],nil]show]

 

 

 

 

就酱,妈妈再也不用担心我写代理了

附Git地址

UIAlertView-Blocks

  

转载于:https://www.cnblogs.com/cc412/p/4281646.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值