2017-05-31 34 views
0

我正在開發一個必須顛倒的應用程序。 我想顯示一個對話框給用戶,他可以接受(這會導致自動旋轉)或拒絕。顯示對話框以顛倒iOS應用程序

如何使用objective-c顯示這樣的對話框? 我需要檢查info.plist中的肖像模式以及編程方式在supportedInterfaceOrientations中。對?

非常感謝您提前幫助!

回答

0

爲此使用UIAlertController。

UIAlertController * alert=[UIAlertController 

alertControllerWithTitle:@"Title" message:@"Message"preferredStyle:UIAlertControllerStyleAlert]; 

    UIAlertAction* yesButton = [UIAlertAction 
         actionWithTitle:@"Yes, please" 
         style:UIAlertActionStyleDefault 
         handler:^(UIAlertAction * action) 
         { 
          **//What we write here????????** 


         NSLog(@"you pressed Yes, please button"); 
        // call method whatever u need 
         }]; 
    UIAlertAction* noButton = [UIAlertAction 
          actionWithTitle:@"No, thanks" 
          style:UIAlertActionStyleDefault 
          handler:^(UIAlertAction * action) 
          { 
           **//What we write here????????** 


         NSLog(@"you pressed No, thanks button"); 
         // call method whatever u need 

          }]; 

    [alert addAction:yesButton]; 
    [alert addAction:noButton]; 

    [self presentViewController:alert animated:YES completion:nil];` 
+0

非常感謝您的回答。 – Johan

+0

當然會。不幸的是我被困在旋轉看[鏈接](https://stackoverflow.com/questions/44305964/programmatically-rotate-ios-app-upside-down-using-objective-c) – Johan

相關問題