title: Restrict orientation per view controller
body: <p>I want to say in each view controller which orientation he supports and restrict it to them. This is what I tried:</p>
  
  <ul>
  <li><p>Use a custom navigation controller like in one of my <a href="https://stackoverflow.com/questions/26011521/restrict-orientation-of-view-controller-when-using-a-static-uitableview">old posts</a>, but that doesn't seem to work anymore. The solution is similar to <a href="https://stackoverflow.com/a/13619579/426227">iOS 6 - (BOOL)shouldAutorotate not getting called for navigation controllers pushed viewControllers</a></p></li>
  <li><p>I also tried <a href="http://niftit.com/setting-orientation-in-xamarin-ios/" rel="nofollow noreferrer">Setting Orientation in Xamarin iOS</a>, but the app crashes on the <code>RootViewController</code>. I get a <code>NullReferenceException</code> here. </p></li>
  <li><p>Furthermore I tried <a href="http://webcache.googleusercontent.com/search?q=cache:kqfFfKHc4WgJ:shrixamarin.blogspot.com/2014/10/ios-8-restricting-orientation-on-view.html+&amp;cd=2&amp;hl=de&amp;ct=clnk&amp;gl=us" rel="nofollow noreferrer">IOS 8 : Restricting orientation on a View Controller</a> from the deleted blog from Shri Chakraborty (shrixamarin). Here the app also crashes if I use <code>application:supportedInterfaceOrientationsForWindow:</code>, because the <code>RootViewController</code> is null. The solution seems to be similar to <a href="https://stackoverflow.com/a/25925127/426227">How do I restrict orientation per view controller in iOS7 in a navigation controller hierarchy</a></p></li>
  </ul>
  
  <p>None of the solutions seems to work. Or do I miss something important? How can I restrict the orientation that view controller A is landscape only, view controller B is portrait only and view controller C can be shown in all available orientations?</p>