Created
June 1, 2017 19:56
-
-
Save julesx/125456417f98cd1dd9cc1b4124998514 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: Xamarin.Forms.ExportRenderer(typeof(LandscapePage), typeof(LandscapePageRenderer))] | |
namespace Mobile.Core.Droid.Renderers | |
{ | |
public class LandscapePageRenderer : PageRenderer | |
{ | |
protected override void OnElementChanged(ElementChangedEventArgs<Page> e) | |
{ | |
base.OnElementChanged(e); | |
((FormsAppCompatActivity)Context).RequestedOrientation = ScreenOrientation.Landscape; | |
} | |
protected override void Dispose(bool disposing) | |
{ | |
base.Dispose(disposing); | |
((FormsAppCompatActivity)Context).RequestedOrientation = ScreenOrientation.Sensor; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: ExportRenderer(typeof(LandscapePage), typeof(LandscapePageRenderer))] | |
namespace Mobile.Core.iOS.Renderers | |
{ | |
public class LandscapePageRenderer : PageRenderer | |
{ | |
public override bool ShouldAutorotate() | |
{ | |
return false; | |
} | |
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() | |
{ | |
return UIInterfaceOrientationMask.Landscape; | |
} | |
public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation() | |
{ | |
return UIInterfaceOrientation.LandscapeLeft; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LandscapePage : ContentPage | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment