UIActionSheet封装成BlockAlertView

步骤

1、初始化

1
BlockAlertView *alertView = [[BlockAlertView alloc] initWithTitle:@"图片" style:AlertStyleSheet];

2、添加title和block

1
2
3
4
5
6
7
8
9
[alertView addTitle:@"保存" block:^(id result) {
NSLog(@"保存");
}];
[alertView addTitle:@"分享到微信" block:^(id result) {
NSLog(@"分享到微信");
}];
[alertView addTitle:@"分享到QQ" block:^(id result) {
NSLog(@"分享到QQ");
}];

3、showInView

1
[alertView show];

4、alertView全局变量以免释放

1
_blockView = alertView;

源码

https://github.com/jackyshan/BlockAlertViewController