Search code examples
objective-cxcoderotationviewcontrolleraddsubview

Rotate View which is insider another View


Today, when implementing my program i get a problem. I have three types of views (small view). From them i make another view. (Templates) When full view I add to viewcontroller. As i think, willAnimateToRotation... For small views will not work correctly, because they are inside template. And template inside ViewController. When app rotates i need to change frames for small views. What should i do? How to perform frame change in rotation?

Views are adding to template with addSubview and template to VC also. I pass data to small view from template.


Solution

  • I'd translate this as a ViewController containment problem. You need to forward the rotation messages throughout your view hierarchy, otherwise it'll never reach your small views.

    Best thing to do is to look at the documentation here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

    Go to the "Implementing a Container View Controller" sub-heading for a description and the "Managing Child View Controllers" sub-heading for relevant code.