简体   繁体   中英

Screen is not updating its size after changing landscape to portrait orientation in iOS 16 using Xamarin forms

I am using Xamarin forms.

When user navigates from one screen (which is in landscape mode) to Home Screen (which is in portrait mode), the view inside Home Screen is not updating its size in iOS 16 only . For other screens, it is working fine.

There are 4 tabs on tab bar- Home Tab2, Tab3, Tab4 and More.

All screen except Tab4 should be in portrait mode and screen on Tab4 in Landscape mode.

When I launch app, I can see Home Screen which is in portrait mode.

When I click on Tab4, screen will rotate and I can see Tab4 screen in Landscape mode.

Now when I click on Home, then screen will rotate back to portrait mode but views inside are in Landscape mode. It's not resizing as per portrait mode.

I am sharing screen shot for better understanding of exact issue.

在此处输入图像描述

在此处输入图像描述

I have used Carousel view, FlexLayout, Grid for UI design and data is dynamic from API response.

What changes needs to be done for this? Any hint for this?

[Solution by @BSB. Moved from question to be an answer.]

    <Label x:Name="lblInformation" FontFamily="{StaticResource PrimaryFontNormal}"
                                   Padding="{OnIdiom Phone=20, Tablet=20}"
                                   FontSize="{OnIdiom Phone=14,Tablet=20}"
                                   HorizontalOptions="CenterAndExpand"
                                   VerticalOptions="CenterAndExpand"
                                   HorizontalTextAlignment="{OnIdiom Phone=Start, Tablet=Center}"
                                   VerticalTextAlignment="Center"
                                   BackgroundColor="Transparent"
                                   TextColor="White" />

Codebehind file:

    lblInformation.Text = user?.Information;
    lblInformation.TextType = TextType.Html;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM