Is there known rotation fix for REFrostedViewController component (by Xamarin Inc.) ?

I found a rotation bug when using the REFrostedViewController component (by Xamarin Inc.) in my own app, that can be replicated easily in the sample app.

Steps to repeat:
1. Display frosted menu.
2. Select a menu option that shows a secondary view controller (e.g. Profile in the demo).
3. Display frosted menu.
4. Select a menu option that shows a main view controller (e.g. Home in the demo).
5. Now rotate the device from portrait to landscape or vice versa.
6. Repeat the first 2 steps, and the main and secondary view controllers are not displayed correctly.

Has anyone found a workaround?

Answers

  • AdamCroserAdamCroser AUMember ✭✭

    I found my own work around, and will post it here for others.

    The solution came down to accessing the REFrostedViewController's UINavigationViewController directly to change views. Doing so avoids the device-rotation issues, and is preferable anyway because it means you only have to create your custom view controllers once a menu item is selected.

    So... don't use REMenuViewControllerItem at all.

    Do use use REMenuActionItem instead.

    To display a custom view controller when a menu item is selected use the following command:

                            Command = ()=>
                            {
                                var customVC = new MyCustomViewController();
                                aRootVC.NavigationController.PopViewController(false);
                                aRootVC.NavigationController.PushViewController(customVC, true);
                            },
    

    To return to the main view controller when a menu item is selected use the following command:

                            Command = ()=>
                            {
                                aRootVC.NavigationController.PopToRootViewController(true);
                            },
    

    To provide a menu option that does nothing but close the menu itself, us an empty command:

                            Command = ()=>
                            {
                            },
    
Sign In or Register to comment.