In iOS 8 (I have not tested iOS 7) I have one UITextViewthat has its text set in a storyboard. When the view does appear, the text appears to scroll, and I don't want it to scroll. In fact, I have no idea why anyone will. Can someone explain how to change this behavior so that it looks like scrollable at the top?
This is very easy to reproduce:
- Start a new project
- Add
UITextViewwith restrictions for attaching to fields - Fill it with more text than will fit its borders (helps increase the font size to about 36).
- Run
This is immediately visually obvious, but if you register what is happening, you will see something like the following:
2015-03-10 10:34:47.198 ScrollViewTest[61180:2610445] [Inside viewDidLoad] <UITextView: 0x7f9c79851200; frame = (0 0; 600 600); text = 'Lorem ipsum dolor sit er ...'; clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7f9c78c89df0>; layer = <CALayer: 0x7f9c78c8c220>; contentOffset: {0, 0}; contentSize: {600, 592}>
2015-03-10 10:34:47.288 ScrollViewTest[61180:2610445] [Inside viewDidAppear] <UITextView: 0x7f9c79851200; frame = (0 0; 375 667); text = 'Lorem ipsum dolor sit er ...'; clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7f9c78c89df0>; layer = <CALayer: 0x7f9c78c8c220>; contentOffset: {0, 457.5}; contentSize: {375, 1176}>
Presumably, this is due to a change frameand / or contentSizefrom boot from the storyboard to the actual sizes that need to be displayed.
It looks like the UITextView contentOffset is set , but the accepted answer to this question does not work. This is also not solved by the installation self.automaticallyAdjustsScrollViewInsets = NO.
source
share