ios - 是否可以在Main.storyboard中添加UIAlertController和UIAlertAction

标签 ios objective-c uialertaction

我在Main.storyboard中有一个条形按钮项目,单击时添加了一些操作,我的代码审阅者希望我将UIAlertAction放入Main.storyboard中,而不是将其添加到代码中,我想知道这是否合适吗?如果是,有什么办法可以做到?我找不到UIAlertAction对象。

- (IBAction)openFileUIBarButtonItem:(UIBarButtonItem *)sender {

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
                                                                   message:nil
                                                            preferredStyle:UIAlertControllerStyleActionSheet];

    UIAlertAction *pickFileButton = [UIAlertAction actionWithTitle:@"Pick A File" 

    //......
}

最佳答案

不,您不能在UIAlertController中添加UIAlertActionMain.storyboard...。只需像上面所做的那样,尝试通过编程方式将其添加。

关于ios - 是否可以在Main.storyboard中添加UIAlertController和UIAlertAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44780129/

相关文章:

iphone - 在webapp中打开一个URL时,如何在不跳转到Safari的情况下显示其中的新页面?

objective-c - 如何访问二进制文件数据而不将其完全加载到 Cocoa 中?

objective-c - 在类扩展或@implementation block 中添加伪私有(private)变量有什么区别?

ios - CKServerChangeToken 的 "scope"是什么?

ios - 如何创建包装 UIOffset 结构的 NSValue?

ios - 尝试在 Swift 3 中保存自定义对象时尝试插入非属性列表对象

objective-c - 安装应用程序后运行相同的代码

ios - 在不使用 segue 的情况下单击确定警报按钮后导航到另一个 View

swift - 在 Swift 中制定隐私政策 : How to make UIAlertController action button disabled until message is scrolled to the bottom

ios - 如何在 ObjC 中普遍更改 UIAlertController 按钮颜色