iPad UIViewController loads as portrait when device is in landscape

Posted by jud on Stack Overflow See other posts from Stack Overflow or by jud
Published on 2010-04-29T21:41:38Z Indexed on 2010/04/29 21:47 UTC
Read the original article Hit count: 439

Filed under:
|
|
|

I have an application with 3 view controllers. They are all have shouldAutoRotateToInterfaceOrientation returning YES. The first two, my main menu and my submenu both autorotate just fine. The third viewcontroller, which programatically loads a UIImageView from a jpg file in the program's bundle, will only display in portrait.

In the viewcontroller containing the image, i have this:

NSString *imageName = [NSString stringWithFormat:@"%@-00%d.jpg",setPrefix,imageNumber];

UIImageView *pictureView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];

pictureView.frame = CGRectMake(0, 0, 1024, 768);

[self.view addSubview:pictureView];

and again, I have shouldAutoRotateToInterfaceOrientation returning YES for all orientations.

My image shows up, but is sideways, and the 0,0,1024,768 values I used to make my rectangle start from the top right corner going down, instead of starting at the top left and going across (holding in landscape). Am I missing a parameter I need to set in order to ensure the imageview shows up in landscape instead of portrait?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ipad