TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2015 |
Maintained by Taiki Suzuki.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Set MOAlertControllerStyleAlert
to preferredStyle.
MOAlertController *alertController = [MOAlertController alertControllerWithTitle:@"MOAlertController" message:@"This is MOAlertController." preferredStyle:MOAlertControllerStyleAlert];
MOAlertAction *action = [MOAlertAction actionWithTitle:@"Cancel" style:MOAlertActionStyleCancel handler:^(MOAlertAction *action) {
//Write a code for this action.
}];
[alertController addAction:action];
MOAlertAction *action2 = [MOAlertAction actionWithTitle:@"Destructive" style:MOAlertActionStyleDestructive handler:^(MOAlertAction *action) {
//Write a code for this action.
}];
[alertController addAction:action2];
MOAlertAction *action3 = [MOAlertAction actionWithTitle:@"Default" style:MOAlertActionStyleDefault handler:^(MOAlertAction *action) {
//Write a code for this action.
}];
[alertController addAction:action3];
[controller presentViewControllerWithCurrentViewController:self];;
Set MOAlertControllerStyleActionSheet
to preferredStyle.
MOAlertController *alertController = [MOAlertController alertControllerWithTitle:@"MOAlertController" message:@"This is MOAlertController." preferredStyle:MOAlertControllerStyleActionSheet];
MOAlertAction *action = [MOAlertAction actionWithTitle:@"Cancel" style:MOAlertActionStyleCancel handler:^(MOAlertAction *action) {
//Write a code for this action.
}];
[alertController addAction:action];
MOAlertAction *action2 = [MOAlertAction actionWithTitle:@"Destructive" style:MOAlertActionStyleDestructive handler:^(MOAlertAction *action) {
//Write a code for this action.
}];
[alertController addAction:action2];
MOAlertAction *action3 = [MOAlertAction actionWithTitle:@"Default" style:MOAlertActionStyleDefault handler:^(MOAlertAction *action) {
//Write a code for this action.
}];
[alertController addAction:action3];
[controller presentViewControllerWithCurrentViewController:self];
If you want to dismiss, use this method.
[controller dismissViewControllerFromCurrentViewController];
Taiki Suzuki, [email protected]
MOAlertController is available under the MIT license. See the LICENSE file for more info.