HDAlertView 是一个类似系统、微信、QQ 等等 App 的 alertView 弹窗。
HDAlertView *alertView = [HDAlertView alertViewWithTitle:@"HDAlertView" andMessage:@"similar system UIAlertView"];
[alertView addButtonWithTitle:@"ok" type:HDAlertViewButtonTypeDefault handler:^(HDAlertView *alertView) {
NSLog(@"ok");
}];
[alertView addButtonWithTitle:@"cancel" type:HDAlertViewButtonTypeDefault handler:^(HDAlertView *alertView) {
NSLog(@"cancel");
}];
[alertView show];
推荐使用 CocoaPods 进行安装
platform :ios, '7.0'
target :'your project' do
pod 'HDAlertView'
end
Pod install
系统自带的 UIAlertView 存在常见 Bug,比如和系统键盘动画冲突等等,需要代理操作等诸多不便使用。使用 UIAlertController 就不会有 UIAlertView 等问题,但不支持 iOS7,所以自定义一个类似系统的 UIAlertView,用法和 UIAlertController 相似,而且简单。
HDAlertView 是基于 MIT 许可证发布的。有关详细信息,请参阅 LICENSE 文件。