gpt4 book ai didi

swift - 如何使用 swift 通过 UIAlertAction 打开输入附件 View ?

转载 作者:行者123 更新时间:2023-11-30 13:20:40 25 4
gpt4 key购买 nike

我有一个 UIAlertController ,其中包含一些 UIAlertActions ,如下所示。

let alertController = UIAlertController(title: nil, message : nil, preferredStyle: .ActionSheet)
let addMoreAction = UIAlertAction(title: "Add more", style: .Default) { (action) in
// Want to be able to call an input accessory view from here
}
alertController.addAction(addMoreAction)
self.presentViewController(alertController, animated: true, completion: nil)

当用户单击“添加更多”操作时,它应该关闭 UIAlertController 并打开键盘,并在键盘顶部附加一个 UITextView。 (就像您在 Facebook Messenger 等聊天应用程序中看到的那样)。

如何使用 swift 实现此目的?

最佳答案

也许您正在寻找 inputAccessoryView 属性。您可以查看this tutorial 。使用它,您可以制作自己的 View ,该 View 可以显示在键盘顶部。

关于swift - 如何使用 swift 通过 UIAlertAction 打开输入附件 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37783234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com