iPhone中的动态文本字段是否可用? [英] Dynamic text fields in iPhone are possible or not?
问题描述
我试图在iPhone屏幕上动态放置textFields,但是我不知道如何启动它.
I am trying to place textFields on iPhone screen dynamically but I am not getting an idea how to start it.
我必须在用户点击的地方放置一个textField.当用户点击屏幕时,应该在此处放置文本字段或textView,并且用户可以在此处写评论.有可能吗?
I have to place a textField where ever the user taps. when a user tap on screen a text field or textView should be places there and user can write a comment over there. Is it possible?
推荐答案
是的,确实可以在屏幕上动态添加 UITextField
.
Yes, it is indeed possible to add UITextField
's to a screen dynamically.
一个 UITextField
只是另一个视图(尽管它是继承自 UIControl
然后是 UIView
的视图).以编程方式创建 UITextView
后,可以通过 addSubview
将其添加到屏幕上的视图中.
A UITextField
is just another view (albeit one that inherits from UIControl
and then UIView
). After you create a UITextView
programatically, you can add it via addSubview
to the view that is on screen.
这篇关于iPhone中的动态文本字段是否可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!