Question

I have a scrollview which cointains a uitextfield, a uitextview and two label The uitextfield and the two label don't scroll. In portrait mode all works fine. In landscape mode, I resize the scroll view in the way that the labels are not visible, only title and textview remains, but I have a problem when the user try to insert the text in the textview. The current position is under the title, so the user cannot see what he/she insert. I would lower it. Using the autosizing masks in IB, don't change the situation: I have to make flexible only the uitextview. What can I try? I thought that scrollRangeToVisible could help me, but nothing.

Was it helpful?

Solution

Try using

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {

or

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {

in your view controller to place your uiTextView where you need it depending on the orientation. Change the textview's frame to something that works visually. I think the first method ignores IB's resizing masks, so you have to set coordinates for your objects' frames using CGRectMake. The second method will animate the rotation as per the resizing masks, but then will "all of a sudden" move the objects to where you specified their frames to be (again using CGRectMake).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top