forked from AliSoftware/OHAlertView-OHActionSheet
-
Notifications
You must be signed in to change notification settings - Fork 0
UIAlertView & UIActionSheet subclasses that uses blocks to handle their callback (which make the code much more easier and readable)
License
G-P-S/AlertViewEx-ActionSheetEx
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
These two classes make it easier to use UIAlertView and UIActionSheet classes by using blocks. This allows you to provide directly the code to execute (as a block) in return to the tap on a button, instead of declaring a delegate and implementing the corresponding methods. This also has the huge advantage of simplifying the code especially when using multiple UIAlertViews and UIActionSheets in the same object (as in such case, it is not easy to have a clean code if you share the same delegate) Note: Blocks a a feature introducted in (and only compatible starting) iOS 4.x ---------- Example: [UIAlertViewEx showAlertWithTitle:@"Alert Demo" message:@"You like this sample?" cancelButton:@"No" okButton:@"Yes" onButtonTapped:^(UIAlertViewEx* alert, NSInteger buttonIndex) { NSLog(@"button tapped: %d",buttonIndex); if (buttonIndex == alert.cancelButtonIndex) { NSLog(@"No"); } else { NSLog(@"Yes"); } }]; ---------- NOTE FOR PRE-iOS 4.0 This class is designed to be used with blocks, which are a new feature introduced in iOS 4.0. To assure the compatibility with pre-iOS4, UIAlertViewEx also propose the possibility to associate a userInfo dictionary to the UIAlertView, and specify a @selector to call on a given delegate, so that you can at least specify a different delegate method in case you have multiple UIAlertViews using the same delegate.
About
UIAlertView & UIActionSheet subclasses that uses blocks to handle their callback (which make the code much more easier and readable)
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published