为什么 uiscroll 视图中的 uitextfield 不滚动?
我有一个滚动视图,其中包含一个文本字段和一个文本视图。我希望两者一起滚动。我该怎么办?现在只有文本视图滚动。
准确地说,我希望当用户在文本视图中写入时标题向上滚动,如果用户决定设置它,他可以向上滚动并重新查找文本字段。
谢谢
I have a scrollview which contains a text field and a text view. I would that both two scrolled together. How can I do? Now only the text view scroll.
Precisely, I would that the title scrolls up while the user writes in the textview and, if the user decides to set it, he can scrolls up and refind the textfield.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试这个
在 .h 中
并在界面生成器中连接它
并在您的 .m 文件中将其放入 viewDidLoad 中,
然后将您的 textField 和 textView 放入界面生成器中的 scroolView 中
try this
in .h
and connect it in the interface builder
and in your .m file put this into your viewDidLoad
then put your textField and your textView inside the scroolView in the interface builder
我想说一件事,
这里textfield只能有一行数据,而textview有多行数据。
因此,在您的比赛中,两者都会滚动,但您说一个在滚动,另一个则不滚动。
在此我期望的是滚动视图不滚动,但文本视图显示其数据(内容)。
就是这样。
如果您想检查这一点,请将文本视图框架增加到其内容并将 userInteractionEnabled 设置为 NO,然后将滚动视图内容大小设置为大于文本视图大小。然后你可以观察到两者都在滚动。
问候,
萨蒂亚
I want to say one thing,
Here the textfield can have only one line and the textview has multi-line of data.
So in your contest both will scroll, but you are saying one is scrolling and other is not.
In this what I am expecting is scrollview is not scrolling but the text view is showing its data(content).
Thats it.
If you want to check this, increase the textview frame upto its content and put
userInteractionEnabled as NO
and then set the scrollview content size to some what more than the textview size. Then you can observe both are scrolling.Regards,
Satya