Question

I'm developing an iphone app and it allows for both portrait and landscape orientation. However, I have a background image, in an UIImageView, which should not be rotated when the orientation changes. I've searched around and experimented with some options, but have not found a satisfactory solution. I tried using transforms in willAnimateRotationToInterfaceOrientation: but it makes the image move during rotation, and doesn't look good. I would like it to remain stationary.

Any help appreciated.

Was it helpful?

Solution

Maybe try this:

YourAppDelegate *appDel = [UIApplication sharedApplication].delegate;
[appDel.window insertSubview:yourImageView atIndex:appropriateIndex];

as your appDelegate.window doesn't care about the current device orientation it might work out as a solution. I just tried adding a UIImageView to the appDel.window in the

didFinishLaunchingWithOptions

method, and as expected, it does not rotate with the above uiviewcontroller.view

Of course you could also try addSubview:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top