I have a UIScrollView and a UIImageView which I have created programatically without interface builder. How can I make sure both auto-rotate in horizontal orientation?
+1
A:
make sure you have implemented shouldAutorotateToInterfaceOrientation and then do a little
yourView.transform = CGAffineTransformIdentity;
yourView.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
and using this in your header files can be very useful
#define degreesToRadian(x) (M_PI * (x) / 180.0)
ChinaPaul
2010-07-28 02:07:42
+1
A:
If you're subclassing UIViewController, even programmatically, you should get rotation for free. Just make sure you set the autoresizingMask on the scroll view and image view so that the mask is set to UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
if you want the view to adapt to the new screen dimensions.
lucius
2010-07-28 05:52:59