![]() User367546 if we want to have three pages and for second page only we need to have landscape orientation, below code is working for me.Īdd below method to AppDelegate.cs public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow) If(e.PropertyName=nameof(CustomContentPage.DoRotate))Īctivity.RequestedOrientation = localControl.DoRotate ? ScreenOrientation.SensorLandscape : ScreenOrientation.Portrait Protected override void OnElementPropert圜hanged(object sender, 圜hangedEventArgs e)īase.OnElementPropert圜hanged(sender, e) LocalControl = (e.NewElement as CustomContentPage) Protected override void OnElementChanged(.ElementChangedEventArgs e) Void DoRotatePropert圜hanged(bool oldValue, bool newValue) Public static readonly BindableProperty DoRotateProperty = BindableProperty.Create(p => p.DoRotate, false, BindingMode.Default, null, propert圜hanged: (d, o, n) => (d as ContentPageBase).DoRotatePropert圜hanged(o, n)) In PCL: public class CustomContentPage : ContentPage Thanks to i came up with this generic solution that doesn't track previous states and is controlled by the ContentPage. Public class PortraitOnlyPage : CustomPage No matter what orientation you came from this page will always be in portrait, then you can switch the orientations for landscape. Then inherit from the CustomPage instead of a ContentPage when creating your PCL views. Protected override void OnElementChanged(ElementChangedEventArgs e)īase.OnElementChanged(e) ((MainActivity)Context).RequestedOrientation = ScreenOrientation.Portrait Public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation() } public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() Public class CustomPageRenderer : PageRenderer The easiest thing is to create a custom renderer for the page you want to force to a specific orientation.įirst create a new class in the PCL that extends ContentPage.Ĭreate a custom renderer for this new class and override the following. For Android, when I use the same code in required renderer page, once I open the open the page(for which orientation is programmed) in phone, from this time, Same orientation is applied for all the pages in the app I hope that would help, let me know if you need any help.ĭon't forget to like my post if you find it useful :wink: Return UIInterfaceOrientationMask.Landscape ((NavigationPage)mainPage).CurrentPage is M圜ustomContentPage) || (mainPage.Navigation != null & If (mainPage is M圜ustomContentPage || (mainPage is NavigationPage & Return UIInterfaceOrientationMask.Portrait Public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, _previousOrientation = activity.RequestedOrientation Īctivity.RequestedOrientation = ScreenOrientation.Portrait Ģ- In iOS, you can override GetSupportedInterfaceOrientations in the AppDelegate class to return one of the UIInterfaceOrientationMask values, example (tested successfully): public partial class AppDelegate : global:.FormsApplicationDelegate If (_previousOrientation = ScreenOrientation.Unspecified) ![]() ScreenOrientation.Portrait : _previousOrientation Įlse if (visibility = ViewStates.Visible) Protected override void OnWindowVisibilit圜hanged(ViewStates visibility)īase.OnWindowVisibilit圜hanged(visibility) Īctivity.RequestedOrientation = _previousOrientation = ScreenOrientation.Unspecified ? Private ScreenOrientation _previousOrientation = ScreenOrientation.Unspecified Public class CustomContentPageRenderer : .PageRenderer Here is an example (tested successfully): This flag can be set to activity in the following way.1- In android, as it is mentioned above you can set the RequestedOrientation property using a renderer, ![]() !Kotlin Bugsee.addSecureActivity(MySecretActivity::())Īctivities with system flag FLAG_SECURE are protected from video and touches recording without necessity to call any Bugsee methods. We substitute the actual screen content with black frames and stop recording touch events. ![]() Whenever user navigates to such activity, You can protect any activity and prevent it from being recorded by adding it's class to the list of secure activities. Video recording can be disabled completely using VideoEnabled launch option. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |