views:

102

answers:

1

I have a view based app. Its self.view has several subviews and shouldAutorotateToInterfaceOrientation is returning YES.

When I rotate the device, all views rotate as expected.

Is that possible to prevent a subview from auto rotating even if the view's parent is auto rotating?

+1  A: 

Keep in mind that it's the view controller that controls what happens during rotation and not the view itself. You can't stop a subview from rotating by setting a property, or something relatively easy, if its parent view's UIViewController is set to auto rotate. You can, however, have sibling views where one rotates and the other doesn't. It's probably possible to layout your views the way you want but not have the one that shouldn't rotate as a subview of a rotating UIViewController.

You could probably write some code that will reorient a subview so it appears not to rotate when the parent view does rotate, however.

yabada
what do you mean by "sibling views where one rotates and the other doesn't. ".. this is exactly what I am asking for... can you elaborate this?
Digital Robot
By sibling views, I mean that they both have the same parent. So, for example, if you have two view controllers and each of their respective views are added to the window in the appDelegate as subviews they are siblings. Then you can control what each view controller does in response to a rotation. If you have a view controller that has a view that is a subview of another view controller's view, then you can't very easily independently control how they respond to rotation.
yabada
Ahhh... I got the point. Thanks!!!!
Digital Robot