title: Orientation lock is not working in xamarin ios
body: <p>I have to lock the single viewcontroller to landscape and other viewcontroller rotate all side. I have tried the below code. But the view orientation is not changed as landscape. Please give your suggestions.</p>
  
  <p>AppDelegate.cs</p>
  
  <pre><code>public bool RestrictRotation
  {
     get;
     set;
  }
  
  [Export("application:supportedInterfaceOrientationsForWindow:")]
  public UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, IntPtr
      forWindow)
  {
      if (this.RestrictRotation)
          return UIInterfaceOrientationMask.Landscape;
      else
          return UIInterfaceOrientationMask.All;
  }
  </code></pre>
  
  <p>Viewcontroller.cs</p>
  
  <pre><code>public override void ViewDidLoad()
  {
      base.ViewDidLoad();
      this.RestrictRotation(true);
      // Perform any additional setup after loading the view, typically from a nib.
  }
  
  public override bool ShouldAutorotate()
  {
      return false;
  }
  
  public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
  {
      return UIInterfaceOrientationMask.Landscape;
  }
  
  public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation()
  {
      return UIInterfaceOrientation.LandscapeLeft;
  }
  
  void RestrictRotation(bool restriction)
  {
      AppDelegate app = (AppDelegate)UIApplication.SharedApplication.Delegate;
      app.RestrictRotation = restriction;
  }
  </code></pre>