微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Xamarin Forms iOS安全区域会在加载时调整大小吗?

如何解决Xamarin Forms iOS安全区域会在加载时调整大小吗?

有点奇怪。我已经在Xamarin Forms(Shell)中构建了一个应用程序,并且在Android上一切正常。当我在ios(iPhone 11物理设备)中导航到新页面时,屏幕似乎弹出并调整大小。我认为这与视图中使用的安全区域属性有关,因为它似乎位于安全区域中,然后调整大小到安全区域中,所以发生的速度有点太慢。

对Android没有影响。

我无法在新项目中重新创建,但是我当前的项目有大量的时间投入,并且我不想再次开始...我无法适应现有的项目,问题仍然存在。

下面是一些示例代码,但奇怪的是,它似乎可以在新项目中工作,因此我正在寻找有关在其他地方设置调试该问题的指南。有什么想法吗?可以根据需要提供其他代码示例。

我已经尝试过升级和降级软件包等。

包裹

我使用

导航
   private async Task ExecuteAddPageCommand()
        {
            await PushAsync(new AddPagePage());
        }

PushAsync在我的baseview模型中

    public async Task<bool> PushAsync(Page page)
    {
        try
        {
            await Shell.Current.Navigation.PushAsync(page);
            return true;
        }
        catch
        {
            await Shell.Current.GoToAsync(Utilities.Routes.ErrorModalPage);
            return false;
        }
    }

页面具有标准属性(示例)

<?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:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOsspecific;assembly=Xamarin.Forms.Core"
             ios:Page.UseSafeArea="true"
             Visual="Material"
             x:Class="namespace:Thing.Views.AddPage"
             xmlns:converter="clr-namespace:Thing.Converters"
             xmlns:controls="clr-namespace:Thing.Controls"
             xmlns:utilities="clr-namespace:Thing.Utilities"
             >
    <ContentPage.Resources>
    <ResourceDictionary>
      <converter:IntToEnumConverter x:Key="IntToEnum"/>
      <converter:InverseBoolConverter x:Key="InverseBool"/>

    </ResourceDictionary>
  </ContentPage.Resources>
    <ContentPage.Content>
      <Grid>
        <Grid.RowDeFinitions>
          <RowDeFinition Height="2*"></RowDeFinition>
          <RowDeFinition Height="5*"></RowDeFinition>
                <RowDeFinition Height="1*"></RowDeFinition>

           </Grid.RowDeFinitions>

            <controls:PageHeader Grid.Row="0" ShowBackButton="true"
                           HeaderTitle="New Thing"
                HeaderImage="{x:Static utilities:Icons.AddMenuIcon}" 
                                 BackCommand="{Binding NavigateBackCommand}"/>

        <StackLayout Grid.Row="1">
          <Label Text="What do you want to call this?" Style="{StaticResource Formlabel}"/>
          <Entry Text="{Binding Name.Value}" Placeholder="E.g. My shiny thing"/> 
        </StackLayout>
        <StackLayout Grid.Row="2" Orientation="Horizontal">
          <Button HorizontalOptions="FillAndExpand" Text="Cancel" Command="{Binding NavigateBackCommand}"></Button>
          <Button HorizontalOptions="FillAndExpand" Text="Save" Command="{Binding SaveCommand}"></Button>
        </StackLayout>
      </Grid>
    </ContentPage.Content>
</ContentPage>

解决方法

我遇到了完全相同的问题,并且更新到最新版本(4.8.1269)并没有帮助。似乎此问题是在4.7.1260中引入的。我降级到4.7.1239,一切都恢复了。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?