Compatible(<= iOS8) UIAlertController written in Objective C
iOS 8 included the new UIAlertController which is upgrading the UIAlertView; however, if your app is still supporting lower version of iOS 8, like most of us are, then you still need to use UIAlertViews.
CompatibleAlertController is supporting iOS 8 & lower version and it emulates the UIAlertController.
Code samples are provided in the demo project. You'll find this easy, if you're familiar with the UIAlertController.
compatibleAlertController = [CompatibleAlertController compatibleAlertControllerWithTitle:@"TITLE"
message:@"Message"
preferedStyle:CompatibleAlertControllerStyleAlert];
CompatibleAlertAction *defalutAction = [CompatibleAlertAction compatibleActionWithTitle:@"DEFAULT"
style:CompatibleAlertActionStyleDefault
handler:^(CompatibleAlertAction*action){
NSLog(@"DEFAULT ....");
}];
[compatibleAlertController addAction:defalutAction];
If you want to use another type of button, you can simply use by changing the param for style of CompatibleAlertActionStyle.
[compatibleAlertController presentCompatibleAlertController:self
animated:YES
completion:^{
//DO SOMETHING...
}];
- You need to retain the "CompatibleAlertController" in iOS 7, otherwise when selecting a button from the "UIAlertView" you'll get an exception.
- Tests!
- Probably a lot more! PR's are welcome.
"PRCompatibleAlertController" is licensed under the MIT License. See LICENSE for details.