Reputation: 133
Can a subview, let's say a UIView, be blocked from rotating to landscape while its super view, the VC, and one of its own subviews, a label for example, are enabled for rotation? I haven't found any examples so I don't know if it is possible. Would it break the view hierarchy?
Upvotes: 2
Views: 939
Reputation: 535306
The matter is discussed by Apple here:
https://developer.apple.com/library/content/qa/qa1890/_index.html
You can't disable a subview from rotation, but you can counter-rotate the subview when rotation takes place. That's how Apple's Camera app behaves, for instance.
If you have view A containing view B containing view C, and view A rotates and you don't want view B to rotate, view B must counter-rotate. But then if you want view C to rotate, it must rotate explicitly, in effect counter-counter-rotating so that it doesn't counter-rotate along with view B.
Upvotes: 3