QLAlertViewController
示例
要运行示例项目,首先克隆仓库,然后从 Example 目录运行 pod install
使用
#import "QLAlertViewController.h"
QLAlertViewController *alert = [QLAlertViewController alertWithTitle:@"this is title" message:@"i am message" style:style];
QLAlertAction *cancleAction = [QLAlertAction actionWithTitle:@"Cancle Action" style:QLAlertActionStyleCancel handler:^{
NSLog(@"this is cancle Action");
[alert dismissViewControllerAnimated:YES completion:nil];
}];
QLAlertAction *dangerAction = [QLAlertAction actionWithTitle:@"Danger" color:[UIColor redColor] font:[UIFont systemFontOfSize:18.0f] style:QLAlertActionStyleDefault handler:^{
NSLog(@"Danger");
}];
[alert addActions:@[cancleAction,dangerAction]];
if (count > 0) {
QLAlertAction *ignoreAction = [QLAlertAction actionWithTitle:@"Ignore" color:[UIColor grayColor] font:[UIFont systemFontOfSize:14.0f] style:QLAlertActionStyleDefault handler:^{
NSLog(@"ignoreAction");
}];
QLAlertAction *passAction = [QLAlertAction actionWithTitle:@"AassAction" color:[UIColor greenColor] font:[UIFont systemFontOfSize:20.0f] style:QLAlertActionStyleDestructive handler:^{
NSLog(@"passAction");
}];
[alert addActions:@[ignoreAction,passAction]];
}
[self presentViewController:alert animated:YES completion:NULL];
安装
QLAlertViewController 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中
pod 'QLAlertViewController'
作者
Paramita, [email protected]
许可协议
QLAlertViewController遵循MIT许可协议。有关更多信息,请参阅LICENSE文件。