forked from organicmaps/organicmaps
[ios] Added show alert to common view controller.
This commit is contained in:
parent
6ec49def12
commit
2ad0a40aa7
2 changed files with 27 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
@interface ViewController : UIViewController
|
||||
|
||||
- (void)refresh;
|
||||
- (void)showAlert:(NSString *)alert withButtonTitle:(NSString *)buttonTitle;
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#import "Common.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "MapViewController.h"
|
||||
#import "ViewController.h"
|
||||
#import "../../3party/Alohalytics/src/alohalytics_objc.h"
|
||||
#import "3party/Alohalytics/src/alohalytics_objc.h"
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
|
@ -36,4 +37,28 @@
|
|||
[super viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
- (void)showAlert:(NSString *)alert withButtonTitle:(NSString *)buttonTitle
|
||||
{
|
||||
if (isIOSVersionLessThan(8))
|
||||
{
|
||||
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:alert
|
||||
message:nil
|
||||
delegate:nil
|
||||
cancelButtonTitle:buttonTitle
|
||||
otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
}
|
||||
else
|
||||
{
|
||||
UIAlertController * alertController =
|
||||
[UIAlertController alertControllerWithTitle:alert
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction * okAction =
|
||||
[UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleCancel handler:nil];
|
||||
[alertController addAction:okAction];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Reference in a new issue