2016-08-16 15 views
1

UIAlertControllerStyleActionSheetを表示するデフォルトの位置を変更する必要があります。位置を変更するUIAlertController(UIAlertControllerStyleActionSheet)

デフォルトの位置は

enter image description here

は私が

enter image description here

する必要があることは可能ですか?

+0

両方の画面が同じ順序を示しています。キャンセル、Facebook、Twiter。希望の注文を更新してください。 – kaushal

+0

私は自分自身を間違って説明したようだと私は謝罪する。私が欲しいのは、「ギャップ」が2番目の画像に表示されている(私はそれを編集した) – Quetool

答えて

0

UIAlertControllerアクションの行の位置は、常にUIAlertActionを追加する順序に依存します。

コード下に試し:

UIAlertController * alertController = [UIAlertController alertControllerWithTitle: preferredStyleゼロ: メッセージゼロUIAlertControllerStyleActionSheet]。

UIAlertAction *cancelAction = [UIAlertAction 
            actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel action") 
            style:UIAlertActionStyleCancel 
            handler:^(UIAlertAction *action) 
            { 
             NSLog(@"Cancel action"); 
            }]; 
    UIAlertAction *FacebookAction = [UIAlertAction 
            actionWithTitle:NSLocalizedString(@"Facebook", @"Facebook") 
            style:UIAlertActionStyleDefault 
            handler:^(UIAlertAction *action) 
            { 

             NSLog(@"Show facebook action action"); 
            }]; 

    UIAlertAction *twitterAction = [UIAlertAction 
           actionWithTitle:NSLocalizedString(@"Twitter", @"Twitter") 
           style:UIAlertActionStyleDefault 
           handler:^(UIAlertAction *action) 
           { 
            NSLog(@"Show Twiter action"); 
           }]; 

    [alertController addAction:cancelAction]; // 1th row from bottom 
    [alertController addAction:twitterAction]; // 2nd row from bottom 
    [alertController addAction:FacebookAction]; // 3rd row from bottom 
+0

私は自分自身を間違って説明したようだと私は謝罪する。私が望むのは、2番目の画像に「ギャップ」が表示されている(編集した) – Quetool

関連する問題