Skip to content

Latest commit

 

History

History
40 lines (22 loc) · 1.41 KB

File metadata and controls

40 lines (22 loc) · 1.41 KB

AlertView and ActionSheet for iOS 6 to iOS 10 version with action handler

<title>AlertView and ActionSheet for iOS 6 to iOS 10 version with action handler</title>

Advantages

used only native controllers

Single line code

easy to use


Disadvantage

cannot be used for complicated purposes

unable to use for alert view with textFields


How to integrate in your project? Add Singleton.h & Singleton.m in your project.

For alert view use the following method for showing alert and if you need to get the action of an alert pass actionHandler.

[[Singleton sharedInstance] showAlertWithTitle:@"alert title" message:@"alert message" arrayOfOtherButtonTitles:@[@"OK",@"1",@"2"] cancelButtonTitle:@"Cancel" presentInViewController:self actionHandler:^(NSString *buttonTitle, NSInteger buttonIndex/**For cancel, buttonIndex will be zero*/) { NSLog(@"button action %d %@",(int)buttonIndex,buttonTitle); }];

For action sheet use the following method for showing action sheet and if you need to get the action of an action sheet pass actionHandler.

      NSLog(@"button action %d %@",(int)buttonIndex,buttonTitle);
  }];```