title: Child View Controller to Rotate While Parent View Controller Does Not
body: <p><strong>What I am Trying to Do:</strong></p>
  
  <p>Parent View that is managed by Parent View Controller <strong><em>SHOULD NOT ROTATE</em></strong>.</p>
  
  <p>Child View that is managed by Child View Controller <strong><em>SHOULD ROTATE</em></strong> to all orientations.</p>
  
  <hr>
  
  <p><a href="https://i.stack.imgur.com/qWYV7.jpg"><img src="https://i.stack.imgur.com/qWYV7.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/SAgi9.jpg"><img src="https://i.stack.imgur.com/SAgi9.jpg" alt="enter image description here"></a></p>
  
  <hr>
  
  <p><strong>What I Have Tried:</strong></p>
  
  <p>ParentViewController</p>
  
  <pre><code>override func supportedInterfaceOrientations() -&gt; UIInterfaceOrientationMask {
      return .Portrait
  }
  
  override func shouldAutorotate() -&gt; Bool {
      return true
  }
  
  fun addChildViewController() {
      let storyBoard = UIStoryboard(name: "Main", bundle: nil)
      self.childViewController = storyBoard("Child View Controller") as? ChildViewController
      self .addChildViewController(self.childViewController!)
      self.childViewController! .didMoveToParentViewController(self)
      self.view .addSubview(self.childViewController!.view)
      self.childViewController!.view.frame = CGRectMake (40, 200, 400, 250)
  }
  </code></pre>
  
  <p>ChildViewController</p>
  
  <pre><code>override func supportedInterfaceOrientations() -&gt; UIInterfaceOrientationMask {
      return  .All
  }
  
  override func shouldAutorotate() -&gt; Bool {
      return true
  }
  </code></pre>
  
  <p>Supported orientations in Xcode Deployment Info are set to all four.</p>
  
  <p><strong>What I Get:</strong></p>
  
  <p>None of the View's rotate.  If I set the parent's rotation to all, all views rotate together.  So it's all or nothing.</p>
  
  <hr>
  
  <p>UPDATE</p>
  
  <p>When I try putting an observer for <strong>UIDeviceOrientationDidChangeNotification</strong> and use UIDevice.currentDevice().orientation to rotate <em>childView</em> using CGAffaineTransformMakeRotate , I get desired results.  HOWEVER, i.e., if I rotate to landscape, and try to pull down the notification center (or if I get a system notification), which is still in the portrait orientation (because the app is natively still left in Portrait), rotated <em>childView</em> rotates back to portrait to honor the status bar/notification/notification center.</p>
  
  <p><strong>Stock iOS Camera App</strong> is the best example I can present.  The main canvas does not rotate in to different orientations, yet the status bar, behind the scenes, rotates honoring device rotation.  Also the subviews rotate within them selves to honor different orientations.  I am trying to achieve this behavior....</p>