How to set Safe Area layout in iPhone x

cheran picture cheran · Mar 15, 2018 · Viewed 7.3k times · Source

I am developing Xamarin forms app and my app seems with safe area set in top. But need to ignore it.

Current scenario:

enter image description here

Excepted scenario:

enter image description here

I have googled regarding this and got below link, tried out as mentioned in below links and nothing worked.

https://forums.xamarin.com/discussion/104945/iphone-x-and-safe-margins-with-xamarin-forms
https://blog.xamarin.com/making-ios-11-even-easier-xamarin-forms/

But didn’t know how to access SetPrefersLargeTitles under Xamarin forms content page in below line mentioned in above link.

On<Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true);

After set safe area as true output come as below, enter image description here

Please help me to resolve this.

Regards, Cheran

Answer

Rasmus Christensen picture Rasmus Christensen · Mar 15, 2018

You can do it from XAML like this

 xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core" 
ios:Page.UseSafeArea="true"