首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

给UIAlertView UIActionSheet 平添block支持

2013-10-22 
给UIAlertView UIActionSheet 添加block支持block是个好语法, 可偏偏 IOS 原生的UIAlertView UIActionShee

给UIAlertView UIActionSheet 添加block支持

block是个好语法, 可偏偏 IOS 原生的UIAlertView UIActionSheet不支持block,本文将给上述个类添加block的支持,

.h文件

UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"title" message:@"msg" delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles:@"ok", nil] autorelease]; [alertView handlerClickedButton:^(NSInteger btnIndex) { NSLogD(@"%d", btnIndex); }]; [alertView show];
其实真这样全部改造下了发先也没简化多少,ui的代码和业务逻辑的代码混在一起了,反而代码更加混乱.

需要dome的同学请自行下载吧

XYQuickDevelop

dome 在点击Something里

热点排行