UIAlertView-Blocks

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

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

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

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

1[[[UIAlertView alloc]initWithTitle:@"提示"message:@"当前网络为移动网络,会产生流量费哦( •̣̣̣̣̣̥́௰•̣̣̣̣̣̥̀ ),是否观看视频?"cancelButtonItem:nil23otherButtonItems:4[RIButtonItem itemWithLabel:@"不看了"action:^{5[SingleZHVideoPlayerPRepareForReusePlayer];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];1516}],nil]show]

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

附Git地址

UIAlertView-Blocks

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航