diff options
Diffstat (limited to 'Example Apps/Example ObjC/ConnectionIAPTableViewController.m')
-rw-r--r-- | Example Apps/Example ObjC/ConnectionIAPTableViewController.m | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/Example Apps/Example ObjC/ConnectionIAPTableViewController.m b/Example Apps/Example ObjC/ConnectionIAPTableViewController.m index bfb931069..645d38b1d 100644 --- a/Example Apps/Example ObjC/ConnectionIAPTableViewController.m +++ b/Example Apps/Example ObjC/ConnectionIAPTableViewController.m @@ -3,9 +3,8 @@ // SmartDeviceLink-iOS #import "ConnectionIAPTableViewController.h" - #import "ProxyManager.h" - +#import "SmartDeviceLink.h" @interface ConnectionIAPTableViewController () @@ -95,5 +94,29 @@ } } +- (IBAction)showAlert:(id)sender { + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"title" message:@"mesaage." preferredStyle:UIAlertControllerStyleActionSheet]; + UIAlertAction *act1 = [UIAlertAction actionWithTitle:@"001" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + + }]; + [alert addAction:act1]; + + int count = 1; + for (UIWindow *window in [UIApplication sharedApplication].windows) { + SDLLogE(@"\n%d:\n\t\trootviewController: %@\n\t\twindow: %@", count, window.rootViewController, window.self); + count += 1; + } + + for (UIWindow *window in [UIApplication sharedApplication].windows) { + if (window.isKeyWindow) { + UIViewController *topViewController = window.rootViewController; + if (topViewController == nil) { + return; + } + [topViewController presentViewController:alert animated:YES completion:nil]; + break; + } + } +} @end |