ユーザー入力を取得するアプリケーションにUIAlertView
を追加しましたが、3番目のボタンを追加する方法は不明です。理想的には、3つのボタンは警告の横方向に横になり、2つのボタンは「キャンセル」ボタンの上にあります。以下のコードスニペットは、UIAlertView
を追加するために使用しています。UIAlertStylePlainTextInputスタイルでUIAlertViewの内部に2つ以上のボタンをどのようにフォーマットしますか?
- (IBAction)initiateSave{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Archive"
message:@"Enter a name to save this as:"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Save Session",@"Save",nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypeDefault;
alertTextField.placeholder = @"eg. My awesome file...";
alert.tag = 1;
[alert show];
[alert release];
self.name = [[alert textFieldAtIndex:0]text];
}
私の答えは唯一可能な正解ではありませんが、それでも正しい答えです。あなたは本当に質問者がしたいことをするつもりはありません。 – matt