如何使用UIAlertStylePlainTextInput样式格式化UIAlertView中的两个以上按钮?

err*_*ran 9 iphone objective-c uialertview ios ios5

UIAlertView在我的应用程序中添加了一个抓取用户输入,但我不确定如何添加第三个按钮.理想情况下,三个按钮将水平跨越警报,或者两个按钮位于"取消"按钮上方.下面的代码片段是我用来添加的代码片段UIAlertView.

- (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];
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

mat*_*att 2

苹果真的不希望你弄乱 UIAlertView。如果它自然格式化的方式不能满足您的需求,请考虑改为使用自定义呈现(“模态”)视图。