开发者

Why a uitextfield inside a uiscroll view doesn't scroll?

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 scro开发者_运维知识库lls up and refind the textfield.

Thanks


try this

in .h

IBOutlet UIScrollView *scrollView;

and connect it in the interface builder and in your .m file put this into your viewDidLoad

     [scrollView setScrollEnabled:YES];
     [scrollView setFrame:CGRectMake(0,55,320,180)];
     [scrollView setContentSize:CGSizeMake(320,320)];

then put your textField and your textView inside the scroolView in the interface builder


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜