如何在iOS中创建弹出菜单? [英] How can I create a popup menu in iOS?
本文介绍了如何在iOS中创建弹出菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建类似于WhatsApp中出现的弹出菜单?
How can I 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
.
推荐答案
这是具有actionSheet
首选样式的UIAlertController
.您可以像这样初始化一个:
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人机界面指南中.
Read the documentation about it in the iOS Human Interface Guidelines.
这篇关于如何在iOS中创建弹出菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文