UIImageView Background Image and Rotation Help

In my iPad app I currently have a background image png of 1024x1024 pixels and set it using the following

UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background-image"]];
[self.view addSubview:imgView];
[self.view sendSubviewToBack:imgView];
[imgView release];

This adds the UIImageView fine and the view is centered in landscape however it is off center in portrait.

I have played around with some of the contentMode settings but not had any luck, I either get portrait to be center or landscape to be center but not both.

Could someone please help me with getting the UIImageView centered in both portrait and landscape after rotation.

Thanks in advance Matt

6
задан Matt Price 11 May 2011 в 11:15
поделиться