My app has a UITextView
, with a long, non-editable, scrollable piece of text. When the user rotates the device, I noticed that the position in the moves. So, for instance, say the device is in portrait mode, and the top-left word is "Stackoverflow", after rotation to landscape, that is no longer the top-left word, the text is off by one or sometimes more lines. If I rotate back to portrait, it shifts even more. Just a little bit every time.
Is there a way to maintain the position on rotation, so the user always sees the same word (or at least the line with that word)?
EDIT: I thought the following could work, but I'm not sure how to code the first part:
- get the range of the first visible word
- rotate
- scroll to the saved range using
scrollRangeToVisible: