My app design requires the same scrolling functionality found in the iPhone's native Photos app when browsing photos in full screen. Specifically:
I started to use Apple's sample PageControl code as a launching point, and everything was going swimmingly until I attempted adding autorotation to the code. My sense from the docs was that all I had to do to get autorotation working was to add this to the sample code's MyViewController.m
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
While that does seem to cause the subviews' backgrounds to rotate, the UILabels and the enclosing UIScrollView stay fixed so that, from a user perspective, paging through the views now requires up/down flicking instead of left/right.
On a whim, I read the stackoverflow post titled "UIButtons don't respond to touch after set frame on autorotate". It links to the blog post below which includes working code that handles all the complex transforms that Apple's sample doesn't include.
Props to Björn Sållarp for making this solution freely available!
http://blog.sallarp.com/shouldautorotatetointerfaceorientation/
For starters, you need to go fiddle with the autoresizing masks on the page control and scrollview (in that sample). I'm still exploring the sample to see what else is required. May have more info in a bit, if someone else doesn't provide the definitive solution before then...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.