LEAlertController
是一个轻量级的 UIActionSheet
。
LEAlertController 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中。
pod "LEAlertController"
要运行示例项目,请克隆仓库,然后从示例目录首先运行 pod install
。
如
LEAlertController *alertController = [LEAlertController alertControllerWithTitle:@"Default Style" message:@"A standard alert." preferredStyle:LEAlertControllerStyleAlert];
LEAlertAction *cancelAction = [LEAlertAction actionWithTitle:@"Cancel" style:LEAlertActionStyleCancel handler:^(LEAlertAction *action) {
// handle cancel button action
}];
[alertController addAction:cancelAction];
LEAlertAction *defaultAction = [LEAlertAction actionWithTitle:@"OK" style:LEAlertActionStyleDefault handler:^(LEAlertAction *action) {
// handle default button action
}];
[alertController addAction:defaultAction];
[self presentAlertController:alertController animated:YES completion:nil];
LEAlertController 根据 MIT 许可证提供。请参阅 LICENSE 文件获取更多信息。