2017-05-31 4 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

関連する問題