iphone开发学习,开源之UIAlertView-Blocks

使用方法简单,说明文档很详细。

给UIAlertView增加扩展方法,使它支持多按钮。

按钮事件通过Blocks

RIButtonItem *cancelItem = [RIButtonItem item];
cancelItem.label = @"No";
cancelItem.action = ^
{
//...
};

RIButtonItem *deleteItem = [RIButtonItem item];
deleteItem.label = @"Yes";
deleteItem.action = ^
{
//...
};

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Delete This Item?" 
                                                    message:@"Are you sure?" 
                                           cancelButtonItem:cancelItem 
                                           otherButtonItems:deleteItem, nil];
[alertView show];
[alertView release];

下载地址:https://github.com/jivadevoe/UIAlertView-Blocks

posted @ 2012-05-21 15:47  Maxfong  阅读(324)  评论(0编辑  收藏  举报