美文网首页iOSUIiOS
iOS AlertView 超酷效果支持Block

iOS AlertView 超酷效果支持Block

作者: iCloudEnd | 来源:发表于2015-02-27 08:51 被阅读1615次

UIAlertView大家可能经常用到,但是UIAlertView 没有block功能,的确不方便。故而找到了这个开源项目,

https://github.com/dogo/SCLAlertView

界面比较酷,不说还支持很多高级功能。

另外,还支持pod,岂不更方便

pod 'SCLAlertView-Objective-C'

SCLAlertView *alert = [[SCLAlertView alloc] init];

//Using Selector

[alert addButton:@"First Button" target:self selector:@selector(firstButton)];

//Using Block

[alert addButton:@"Second Button" actionBlock:^(void) {

NSLog(@"Second button tapped");

}];

//Using Blocks With Validation

[alert addButton:@"Validate" validationBlock:^BOOL {

BOOL passedValidation = ....

return passedValidation;

} actionBlock:^{

// handle successful validation here

}];

[alert showSuccess:self title:@"Button View" subTitle:@"This alert view has buttons" closeButtonTitle:@"Done" duration:0.0f];



相关文章

网友评论

  • a65d014e5792:这个弹框 真是超帅气 可惜以前的项目没用到过

本文标题:iOS AlertView 超酷效果支持Block

本文链接:https://www.haomeiwen.com/subject/ajepxttx.html