Implement Auto Rotate in Auto Scroll sample source by xCode and Objective-C



SDK:    xCode 3.2
Device: iPhone 3GS

Case:      
      How to modify the sample source (2_Autoscroll) to let both UIView and the UIImage in the view rotate correctly while have iPhone rotate event?

Source:
      Please find the 2_Autoscroll source code in:
      http://developer.apple.com/iPhone/library/samplecode/ScrollViewSuite/Introduction/Intro.html

Trhanks.
agicfutureAsked:
Who is Participating?
 
jacekmalinowskiCommented:
Well, you just have to add to the UIViewController this code:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   return YES;
}

Open in new window

0
 
agicfutureAuthor Commented:
Thanks. I added it and work. Thanks. However, seem need to set the uiscrollview and image width...etc as the Image width not match the rotated screen
0
 
jacekmalinowskiCommented:
You can set auto re-size mask to controls.
Sample code for UIImageView imgView:
[imgView setAutoresizingMask:(UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin)];

Open in new window

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
agicfutureAuthor Commented:
Thanks. I will try it
0
 
agicfutureAuthor Commented:
Thanks. I will close this case.

Please kindly help on below question.

http://www.experts-exchange.com/Apple/Programming/Objective-C/Q_26023257.html
0
 
agicfutureAuthor Commented:
Thanks.  Please kindly help on below question too.

http://www.experts-exchange.com/Apple/Programming/Objective-C/Q_26023257.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.