要运行示例项目,请克隆仓库,然后在 Example 目录中首先运行 pod install
。非常容易使用
PWAlertController *alert = [PWAlertController sheetWithTitle:nil cancelButtonTitle:@"取消" destructiveButtonTitle:@"删除" buttonClicked:^(NSUInteger index) {
NSLog(@"alert selected at index:%ld", index);
} otherButtonTitles:@"标题一",@"标题二",@"标题三",nil];
[self presentViewController:alert animated:YES completion:^{
}];
iOS 7 下,需要在
[self presentViewController:alert animation:YES completion:nil];
前面添加一句self.modalPresentationStyle = UIModalPresentationCurrentContext;
PWAlertController 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "PWAlertController"
Paul Wang, b7banana">[email protected]
PWAlertController 根据 MIT 许可提供。有关更多信息,请参阅 LICENSE 文件。