I want to manually update the contentOffset UIScrollView during rotation changes. A scroll view fills the screen and has a flexible width and a flexible height.
I'm currently trying to update the contentOffset in willRotateToInterfaceOrientation , for example:
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [Utils logPoint:myScrollView.contentOffset tag:@"initial"]; myScrollView.contentOffset = CGPointMake(modifiedX, modifiedY); [Utils logPoint:myScrollView.contentOffset tag:@"modified"]; } -(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { [Utils logPoint:myScrollView.contentOffset tag:@"final"]; }
However, the final value is not a modified value, and it seems to be affected by its influence, but this is not obvious to me.
Here are some of the results that I get:
initial: (146.000000;-266.000000) modified: (81.000000;-108.000000) final: (59.000000;-0.000000) initial: (146.000000;-266.000000) modified: (500.000000;500.000000) final: (59.000000;500.000000) initial: (146.000000;-266.000000) modified: (-500.000000;-500.000000) final: (-0.000000;-0.000000)
How to update contentOffset of scroll view during rotation change?
iphone rotation ipad uiscrollview
hpique
source share