如何使用选择器将内容添加到我的 Textview
我想添加一个下拉框,让用户从我的 iPhone 应用程序中的一些预定义值中进行选择,但由于这是不可能的,所以我想我应该使用选择器。如何让文本视图提示选择器值以使用选择填充文本视图?
I wanted to add a drop down box to get the user to select from some pre-defined values in my iPhone app but as that's not possible I thought I would use a picker instead. How do I get the textview to prompt a picker value to populate the Textview with the selection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将
UIPickerView
设置为UITextView
的inputView
并侦听选择器的更改并调整UITextView< 的内容/code> 相应地。不过,您可能仍然会看到一个光标。
inputView 本质上取代了键盘。然而,外部键盘仍然可以在
UITextView
中输入普通文本,除非您通过委托方法阻止这种情况You could set a
UIPickerView
as theinputView
to theUITextView
and listen for changes to the picker and adjust the content of theUITextView
accordingly. You will probably still see a cursor though.The inputView essentially replaces the keyBoard. External keyboard can however still enter normal text into the
UITextView
unless you prevent this via the delegate method我认为你必须禁用
Textview
的属性编辑I think you have to disable the property editing of
Textview