I have a UIScrollView that updates its frame after each interface orientation change, keeping its height but dynamically updating its width to always fill the new width. Since it is a horizontal scroll view with paging enabled, naturally, I am updating its content according to its new size. I do this as follows (obviously it is a simplified code, but you should get the idea):
scrollView.frame = CGRectMake(0.0f, 0.0f, window.size.width, 200.0f);
// Content is being deleted here
// Then redraw with the new width in mind
scrollView.contentSize = (window.size.width * [database count]);
[scrollView setContentOffset:CGPointMake(currentPostionX, 0.0f) animated:NO];
This method works just fine; the scrollview keeps its previous position after each interface orientation change. My problem is that it is not smooth. In fact it is quite ugly, often resulting in a jittery, jumping "animation" when the contentOffset is being reset (and it doesn't matter if I set 'animated' to YES).
There is got to be a better way of doing this and make the scroll view keep its position according to its new dimensions.
Any ideas?
Update: Actually, I call the above methods in the viewWillTransitionToSize's animateAlongsideTransition section, as this creates quite a nice transition while changing between different sizes. If I put them into the completion section, everything just "pops" into place after the rotation, which is quite ugly. This way everything is smooth, except the jumping at the right position at the very end.