Created
January 17, 2015 14:42
-
-
Save Eridana/6b4ee65c0e2bb7c40b8d to your computer and use it in GitHub Desktop.
UIAlertView and UIAlertController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if ( NSClassFromString(@"UIAlertController") != nil ) { | |
| //make and use a UIAlertController | |
| UIAlertController *alertController = [UIAlertController | |
| alertControllerWithTitle:@"Вы не авторизованы" | |
| message:@"Пожалуйста введите логин и пароль" | |
| preferredStyle:UIAlertControllerStyleAlert]; | |
| UIAlertAction *okAction = [UIAlertAction | |
| actionWithTitle:@"OK" | |
| style:UIAlertActionStyleDefault | |
| handler:^(UIAlertAction *action) | |
| { | |
| }]; | |
| /* | |
| UIAlertAction *cancelAction = [UIAlertAction | |
| actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel action") | |
| style:UIAlertActionStyleCancel | |
| handler:^(UIAlertAction *action) | |
| { | |
| NSLog(@"Cancel action"); | |
| }]; | |
| */ | |
| [alertController addAction:cancelAction]; | |
| [alertController addAction:okAction]; | |
| [self presentViewController:alertController animated:YES completion:nil]; | |
| } | |
| else { | |
| //make and use a UIAlertView | |
| UIAlertView *alertView = [[UIAlertView alloc] | |
| initWithTitle:@"Вы не авторизованы" | |
| message:@"Пожалуйста введите логин и пароль" | |
| delegate:self | |
| cancelButtonTitle:@"OK" | |
| otherButtonTitles:nil, nil]; | |
| [alertView show]; | |
| } | |
| // More this - http://useyourloaf.com/blog/2014/09/05/uialertcontroller-changes-in-ios-8.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment