PXAlertView是UIAlertView的替代品,类似于iOS 7的风格,但具有基于块的API并能够自定义样式和添加自定义视图。
将以下内容添加到您的CocoaPods Podfile中
pod 'PXAlertView', '~> 0.1.0'
或者作为git子模块克隆
或者直接将PXAlertView.h
和`.m
文件复制到您的项目中。
请参阅PXAlertView.h以获取完整的API。
[PXAlertView showAlertWithTitle:@"The Matrix"
message:@"Pick the Red pill, or the blue pill"
cancelTitle:@"Blue"
otherTitle:@"Red"
completion:^(BOOL cancelled, NSInteger buttonIndex) {
if (cancelled) {
NSLog(@"Cancel (Blue) button pressed");
} else {
NSLog(@"Other (Red) button pressed");
}
}];
PXAlertView在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。