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

你可能感兴趣的:(uialertview)