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

标签 iphone objective-c ios ios5 uialertview

我在我的应用程序中添加了一个 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];
}

enter image description here

最佳答案

Apple 真的不想让你弄乱 UIAlertView。如果它自然格式化的方式不能满足您的需求,请考虑改用自定义呈现(“模态”) View 。

关于iphone - 如何使用 UIAlertStylePlainTextInput 样式在 UIAlertView 中格式化两个以上的按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9754777/

相关文章:

iphone - 开放式GL-ES 2.0 : Touch detection

objective-c - 读取PNG注释(未压缩的zTXt数据)

ios - 在 NSUserDefaults 中以未排序的方式获取 allKeysForObject 数组

ios - 有没有办法检查 IOS 设备上的 native 操作,例如弹出元素

iphone - 在 IOS 中检测拍手

iPhone:以编程方式检查应用内购买状态

ios - 如何检测设备中是否配置了 Touch ID

ios - 在 Swift 中解析和存储 JSON

ios - 内存管理(带有图像的 UICollectionView)

iphone - 将 int 转换为 NSInteger