iOSUIiOS

iOS AlertView 超酷效果支持Block

2015-02-27  本文已影响1615人  iCloudEnd

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];



上一篇下一篇

猜你喜欢

热点阅读