要运行示例项目,请先克隆仓库,然后从 Example 目录运行 pod install
。
LOAlertController 可以通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile
pod "LOAlertController"
导入
#import "UIAlertController+LOAlertController.h"
设置 alertController 的一个方法
[UIAlertController showWithController:self cancelTitle:@"cancel action title" type:UIAlertControllerStyleActionSheet title:@"title" message:@"message" buttons:@[@"action 1 title", @"action 2 title"] complete:^(NSInteger buttonIndex) {
//return -1 if cancel action pressed
if (buttonIndex == -1) {
return;
}
//button index as bottons
switch (buttonIndex) {
case 0:
//to something
break;
case 1:
//to something
break;
default:
return;
break;
}
}];
vivalalova, [email protected]
LOAlertController 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。