如何隐藏UIAlertController中的标题/消息帧?

vli*_*lin 46 ios swift uialertcontroller

当使用a时UIAlertController,如果我想要呈现UIActionSheet空标题和空消息,则预期放置标题和/或消息的帧仍然存在.

如何更改此设置以便我只显示以下ActionSheet内容:

设置
退出
取消?

谢谢!

UIAlertController示例

aah*_*ens 116

当我使用此代码创建UIAlertController时,我没有标题间距.

[UIAlertController alertControllerWithTitle:nil
                                    message:nil
                             preferredStyle:UIAlertControllerStyleActionSheet];
Run Code Online (Sandbox Code Playgroud)

你是否传递nil标题和消息或空字符串?


Har*_*ngh 7

更新Swift 4:

let alert = UIAlertController(title: nil, message: nil, preferredStyle: UIAlertControllerStyle.actionSheet)
Run Code Online (Sandbox Code Playgroud)

只需将nil传递给标题和消息参数即可。

谢谢


bee*_*eee 5

如果要根据特定情况更改运行时间,只需编写:

actionController.title = nil
actionController.message = nil