如何在iOS中创建弹出菜单? [英] How to create a popup menu in iOS?
本文介绍了如何在iOS中创建弹出菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建类似WhatsApp中的弹出式菜单?
How I can create a popup menu like the one present in WhatsApp?
对于这个愚蠢的问题感到抱歉,但我甚至不知道该搜索什么。我很确定它不是 UIPickerView
。
Sorry for the dumb question, but I don't even know what to search. I'm pretty sure it's not a UIPickerView
.
推荐答案
这是 UIAlertController
,带有 actionSheet
首选样式。你可以这样初始化:
This is a UIAlertController
with an actionSheet
preferred style. You can initialize one like this:
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Action 1", style: .default) { _ in
<handler>
})
alert.addAction(UIAlertAction(title: "Action 2", style: .default) { _ in
<handler>
})
present(alert, animated: true)
阅读文档。
这篇关于如何在iOS中创建弹出菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文