UITextview not showing top lines after rotation to landscape

601 Views Asked by At

I have problem when rotate the device/iOS simulator to landscape. The UITextView doesn´t show up on top. It's showing in the middle instead until I scroll it up. I have tried many things like :

[textView sizeToFit];
[textView layoutIfNeeded];

[textView setContentOffset:CGPointMake(0.0, 0.0)];

[textView scrollRectToVisible:CGRectMake(0.0, 0.0, 1.0, 1.0) animated:NO];

I know my question is quite short, but I see no solution out there that´s help.

Can somebody help me ?

1

There are 1 best solutions below

1
On BEST ANSWER

The real solution I found. In Xcode6:
Choose Navigation Controller-->On the right panel of interface builder -Tick off Adjust Scroll View Inset.

in .m file in viewDidLoad -put this code: [_myTextViewGrm sizeToFit];

And also put this method in .m file

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    [self.myTextViewGrm scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];
}

DONE !!!!