IOS Use Safe Area is ignored for ContentPage that uses Custom Page Renderer

Hi, I have a custom pagerenderer called "CropViewRenderer". This renders a PCL called CropView which inherits from ContentPage.

public class CropView : ContentPage
{
public CropView(IMobileDialogService dialogservice, IDevice device)
{
On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
}

The CropViewRenderer is adding the controls to appear specific for IOS. I notice however when I run this on IPhoneX, The safe area padding for bottom and top are ignored so the controls on the bottom of page overlap

Any ideas please?

Best Answer

  • mbullock976mbullock976 ✭✭
    Accepted Answer

    Yes, Safe area works fine for me otherwise. This image cropper nuget package presents the view controller modally but it doesn't look like it supports Safe Area.

    I just tried it again but this time using a different nuget package and it seems this does support safearea https://libraries.io/nuget/Wapps.TOCrop and so the image cropper content page no longer overlaps the bottom bar on iphone x

    I will maybe try using this nuget package and do some dev testing to make sure the functionality itself remains the same

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); is used on Forms project. It tells forms controls to be placed in the safe area.
    If you create controls on the native iOS project it won't follow this rule. It depends on what constraints/frames you are using.

  • mbullock976mbullock976 Member ✭✭

    Thanks for the reply, I've come to realise with more investigation that the custom page render is essentially displaying Xam.Plugins.ImageCropper (https://github.com/XAM-Consulting/Xam.Plugins.ImageCropper) however it is not taking safearea into account

  • LandLuLandLu Member, Xamarin Team Xamurai

    I haven't used this nuget before.
    Do you mean this issue occurred because you are using this package?

  • mbullock976mbullock976 Member ✭✭
    Accepted Answer

    Yes, Safe area works fine for me otherwise. This image cropper nuget package presents the view controller modally but it doesn't look like it supports Safe Area.

    I just tried it again but this time using a different nuget package and it seems this does support safearea https://libraries.io/nuget/Wapps.TOCrop and so the image cropper content page no longer overlaps the bottom bar on iphone x

    I will maybe try using this nuget package and do some dev testing to make sure the functionality itself remains the same

Sign In or Register to comment.