1

UIAlertView でキーボードが自動的にポップアップしないという iOS 8 の不具合のため、私の唯一の代替手段は UIAlertController にアップグレードすることです。ただし、didDismissWithButtonIndex は、私がしなければならなかったことを行うのに十分柔軟でしたが、提案された新しいソリューションはそうではありません (以下の例を参照)。didDismissWithButtonIndex がないと、UIAlertController にアップグレードできません。以下以外に同様の解決策はありますか?

  UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
    }];

    UIAlertAction *otherAction = [UIAlertAction actionWithTitle:otherButtonTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
    }];

    [alertController addAction:cancelAction];
    [alertController addAction:otherAction];
4

1 に答える 1

0

いいえ、あなたがそれをした方法はあなたができる唯一の方法です. 2 つのアクション間の共通の動作を別のメソッドに抽出し、そのメソッドをブロックから呼び出すことをお勧めします。

于 2014-09-16T17:16:51.697 に答える