IOS上未显示MAUI WebView

zbwhf8kr  于 2022-11-19  发布在  iOS
关注(0)|答案(1)|浏览(224)

我创建了一个应用程序,作为我的网站的网页视图,WebView组件在Android和Windows上显示正常,但在运行iOS 16.X的iOS(iPhone 11)设备上无法显示

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MltDimParisPhoneApp.EnglishPage" 
             NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False"
             Shell.NavBarIsVisible="False">
    <StackLayout VerticalOptions="StartAndExpand" BackgroundColor="DarkSlateGrey">
        <StackLayout Spacing="5" Orientation="Horizontal" Padding="8">
            <Button Text="Go Back" TextColor="DarkSlateGray"/>
            <Button Text="Select Language" x:Name="ChangeLangBtn" TextColor="DarkSlateGray"/>
        </StackLayout>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="100*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100*"/>
            </Grid.ColumnDefinitions>

            <WebView Grid.Row="0" Grid.Column="0" 
                     Source="https://example.com" 
                     VerticalOptions="StartAndExpand" 
                     HorizontalOptions="Fill" 
                     x:Name="WebView"/>
        </Grid>
    </StackLayout>
</ContentPage>

WebView不会显示,但其他控件会显示。

mf98qq94

mf98qq941#

您可以修改webview代码,如下所示:

<WebView Grid.Row="0" Grid.Column="0" 
                     Source="https://example.com" 
                     MinimumHeightRequest="1000"
                     MinimumWidthRequest="200" 
                     VerticalOptions="FillAndExpand" 
                     HorizontalOptions="FillAndExpand" 
                     x:Name="WebView"/>

相关问题