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

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

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

Related

iPhone - scrollview with a textview and tableview inside

I have an interface which will have a text view and a table view below it. My current view looks like this
UIScrollView
UITextView
UITableView
Currently the TextView and TableView can scroll vertically..but what i want is the whole screen to scroll up/down. Why doesn't this work properly?
You can put a TableView inside a ScrollView, but you must resolve conflicts between touches, scrolling, and bouncing in IB or with code, and you must set the ScrollView's contentSize with code, not in IB.
If the TextView really "belongs" to the table, consider putting it in a table cell, or better, as a header, that's what they're for.

scrollview and textview problem with scrolling iphone

i have a view, then in the view i have a scrollview and then in the scrollview i have a bunch of different objects. These objects aren't bigger than the scrollview's size, so i put a textView with a lot of text in the scrollview to see if it works but it is not scrolling. I deactivated the textview's scroll function. Does the scrollview knows the size of my textview? The textview's text is being set programmatically. Here's my view hierarchy:
Thanks in advance.
If you set the text programatically (and the size of the textview I assume since you don't scroll in it) you will have to set the contentSize of the scrollview after that. It doesn't automagically know when one of its elements grow.
And also set
scrollView.scrollEnabled = YES;

label and scroll view

HI FRIENDS..
I use a scroll view and a label now i want that when i scroll that , label also scroll with that and set to next location , i set paging enable = YES , so i want that there are 5 images and when i did scrolling the label i set is also move and show in other position.
thanks
To scroll a UILabel (or anything for that matter) WITH a UIScrollView, simply add the label to the UIScrollView.
You can easily do this in Interface Builder by the obvious methods.
You can also do this programmatically by utilizing the addSubview: method.
You can do one thing you change frame of label when you scroll in delegate method of scrollview or you can also make 5 same label in all 5 pages.
Good Luck
Well if you have added a scrollview on top of a uiview you can add that label on the view and then bring it to front. then you dont have to worry about changing frame of the uilabel as it will be always on top of the scrollview and at the same position and also you can change the text of that label when the user scrolls in pagecontrol value changed method.

in iPhone App set focus on textView

In my iPhone App I have put textField and TextView both
and I have grouped them with scrollview
now the problem is when I call
[textField becomeBecomeFirstResponder];
it sets focus on textField in scrollView and makes content Area visible in scrollView accordingly
But When I do same thing with UItextView:
[textView becomeBecomeFirstResponder];
it does not make TextView visible in scroll view i.e it does not focus on textView (cursor sets on text view but content area of scrollview dose not appear with out manual scrolling)
What shoud I do to set focus on textView and set content area accordingly in in scrollview?
I believe your trouble here is that UITextView is a UIScrollView, while UITextField is a UIControl.
It is quite likely, though I have not tested this in code at the moment, that the best way to handle this is to watch for textView.isFirstResponder and when true, call [scrollView scrollRectToVisible:textView.frame animated:YES] on your UIScrollView.
Be sure u have set textView's delegate.

UIScrollView Zooming

Hi
I have taken a uiscrollview in xib IBOUTLET and have added a subview uitextview, and in that textview, have done horizontal scrolling since there are some contents to be displayed . i just need to do one thing that when user zoom in textview it should zoom , like when user touches two finger , it should have zooming gesture and zoom the content i have tried a lot however it didn't work. please let me know
Put a UITextView object into a UIScrollView object, and make the uitextview larger than the scrollView.
Also set property
scrollView.contentSize = textView.frame.size;
should be placed in the scrollViewDidEndZooming delegate