先看图,意外发现很神奇的东西,最后发现……其实就是UIAlertController
这个风格用的比较少
具体实现代码:
- (IBAction)alertAction {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"致开发者的一封信" message:@"有了您的支持才能更好的为您服务,提供更加优质的,更加适合您的App,当然您也可以直接反馈问题给到我们" preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *refuseAction = [UIAlertAction actionWithTitle:@"��残忍拒绝" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) {
NSLog(@"��残忍拒绝");
}];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"��好评赞赏" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) {
NSLog(@"��好评赞赏");
}];
UIAlertAction *showAction = [UIAlertAction actionWithTitle:@"��我要吐槽" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) {
NSLog(@"��我要吐槽");
}];
[alertController addAction:refuseAction];
[alertController addAction:okAction];
[alertController addAction:showAction];
[self presentViewController:alertController animated:YES completion:nil];
}
总结:因为在开发中,UIAlertController用的还是比较频繁的,还有一个就是MBProgressHUD提示框
我在项目中都是提前把他们封装起来,直接通过类方法调用,省去了很多的时间和代码量,有时间和大家分享一下。
建议大家多多封装一些工具类,有助于对代码的优化以及对封装的理解,同时也节省了不少的时间