0

我有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 实现这一目标?

4

1 回答 1

0

也许您正在寻找inputAccessoryView房产。您可以查看本教程。使用它,您可以制作自己的视图,该视图可以显示在键盘顶部。

于 2016-06-13T06:56:18.530 回答