Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone - UIViewController not rotating when device orientation changes
    primarykey
    data
    text
    <p>I have got my own custom UIViewController, which contains a UIScrollView with an UIImageView as it's subview. I would like to make the image to auto rotate when device orientation changes, but it doesn't seem to be working...</p> <p>In the header file, I've got;</p> <pre><code>@interface MyViewController : UIViewController &lt;UIScrollViewDelegate&gt; { IBOutlet UIScrollView *containerView; UIImageView *imageView; } </code></pre> <p>These components are initialised in the loadView function as below;</p> <pre><code> containerView = [[UIScrollView alloc] initWithFrame:frame]; NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://..."]]; UIImage *image = [[UIImage alloc] initWithData:data]; imageView = [[UIImageView alloc] initWithImage:image]; [image release]; [containerView addSubview:imageView]; </code></pre> <p>And I have added the following method, assuming that's all I need to make the view auto-rotate...</p> <pre><code>-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } </code></pre> <p>MyViewController loads fine with the image I've specified to grab from the URL, and the shouldAutorotate... function is being called, with the correct UIInterfaceOrientation, when I flip the device too.</p> <p>However, didRotateFromInterfaceOrientation method do not get called, and the image doesn't seem to rotate itself... Could someone please point out what I need to add, or what I have done wrong here?</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload