TabBarPicker/Example/Pods/UIAlertViewBlockExtension
..
2015-08-18 15:00:07 +02:00
2015-08-18 15:00:07 +02:00

UIAlertViewBlockExtension

UIAlertView category for block expression

Installation

Using cocoapods

pod 'UIAlertViewBlockExtension'

Features

  • Block expression can be used for handling UIAlertView's clicks.
  • Similar with UIAlertController in iOS 8.0

Examples

UIAlertView *alertView = [UIAlertView alertViewWithTitle:@"title" message:@"message"];

[alertView addButtonWithTitle:@"OK" actionBlock:^(UIAlertView *alertView, NSInteger buttonIndex) {
  NSLog(@"clicked button index : %lu", buttonIndex);
  NSLog(@"cancel button index : %lu", alertView.cancelButtonIndex);
}];
  
[alertView addCancelButtonWithTitle:@"Cancel" actionBlock:^(UIAlertView *alertView, NSInteger buttonIndex) {
  NSLog(@"clicked button index : %lu", buttonIndex);
  NSLog(@"cancel button index : %lu", alertView.cancelButtonIndex);
}];
    
[alertView show];

Requirements

  • iOS version 4.0 or later