我有一个使用 .xib
文件构建的自定义 subview ,以充当 UIActionSheet
(我知道它已被弃用,取而代之的是 UIAlertController
). subview 如下所示:
我想做的是将此 subview 重建为 UIAlertController
。我的问题是,是否可以将 UIToolbar
添加到 UIAlertController
的顶部,如下图所示,并且可以将按钮添加到每个选项的每一行的任一侧( +/- 符号是按钮)。我对重新设计不感兴趣,但是,我想使用具有相同功能的 UIAlertController
重新实现它。这可能吗?有例子吗?
最佳答案
简短的回答是 - 否
。
根据 UIAlertController Class Reference - 您只能向警报添加文本字段。
func addTextFieldWithConfigurationHandler(_ configurationHandler: ((UITextField) -> Void)?)
Calling this method adds an editable text field to the alert. You can call this method more than once to add additional text fields. The text fields are stacked in the resulting alert.
关于ios - 是否可以将工具栏添加到 UIAlertController,以及使用 Swift 将按钮添加到行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38446450/