xamarin.ios - Xamarin iOS misplaced layout after rotation -


i have simple layout:

<?xml version="1.0" encoding="utf-8"?> <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:menulayouttest" x:class="menulayouttest.menulayouttestpage">     <contentview>         <stacklayout orientation="vertical" spacing="0">             <contentview x:name="apppagetopbar" heightrequest="70" backgroundcolor="yellow" />             <absolutelayout verticaloptions="fillandexpand">                 <contentview x:name="apppagemodulecontent" absolutelayout.layoutbounds="0,0,1,1" absolutelayout.layoutflags="all" backgroundcolor="gray"/>                 <contentview x:name="apppagesidemenu" absolutelayout.layoutbounds="0,0,244,1" absolutelayout.layoutflags="heightproportional" backgroundcolor="fuchsia" isvisible="false"  padding="12">                     <contentview backgroundcolor="green"/>                 </contentview>             </absolutelayout>         </stacklayout>     </contentview> </contentpage> 

with following code behind toggles visibility of fuchsia / green area:

public partial class menulayouttestpage : contentpage {     public menulayouttestpage()     {         initializecomponent();          icommand command = new mycommand(apppagesidemenu);          apppagetopbar.gesturerecognizers.add(             new tapgesturerecognizer             {                 command = command         });     }      public class mycommand : icommand     {         private readonly view view;          public mycommand(view view)         {             this.view = view;         }          public event eventhandler canexecutechanged;          public bool canexecute(object parameter)         {             return true;         }          public void execute(object parameter)         {             view.isvisible = !view.isvisible;         }     } } 

if open app in portrait mode , tap yellow area see:

expected layout

but after few rotations , show / hide options layout goes this.

broken layout

i have managed reproduce 100% both on ios simulator , ipad following steps:

  • kill app , restart in portrait mode
  • rotate left twice
  • tap yellow area show fuchsia / green area
  • tap again hide it
  • rotate left twice
  • tap yellow area show fuchsia / green area
  • tap again hide it
  • rotate right once
  • tap yellow area show fuchsia / green area
  • tap again hide it
  • rotate right once
  • tap yellow area show fuchsia / green area
  • you should have seen broken layout

edit 1

here can find sample solution: menulayouttest

edit 2

and able reproduce on nexus 9 :(

edit 3

a bug #43186 has been reported.


Comments