Forum Xamarin.Forms

Xamarin Forms iOS Open Camera Pushes Down Tabbar

Seeing a strange issue against Mono 5.2/5.4 and XCode 9.0

I have a simple tab bar where I prompt a camera from an action bar.

See image below. It pushes down the bar so you can't see the text. However if you rotate the phone, the tab bar text comes back.

Any thoughts what might be going on and what I can do about it? Wasn't having this problem with Mono 5.0.1/XCode 8.3.3

Here is the code I am using to prompt the camera:

    public static async Task<byte[]> GetPhoto()
    {
        await CrossMedia.Current.Initialize();

        if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
        {
            await Application.Current.MainPage.DisplayAlert("No Camera", "No camera available.", "OK");
            return null;
        }

        var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera);
        if (cameraStatus != PermissionStatus.Granted)
        {
            var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Camera });
            cameraStatus = results[Permission.Camera];
        }

        if (cameraStatus == PermissionStatus.Granted)
        {                
            var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
            {
                PhotoSize = PhotoSize.Large,
                AllowCropping = true,
                Name = "axle.jpg"
            });

            if (file != null)
            {
                return file.GetStream().ToByteArray();
            }
        }
        else
        {
            await Application.Current.MainPage.DisplayAlert("Permissions Denied", "Unable to take photos.", "OK");

            if (Device.RuntimePlatform == Device.iOS)
            {
                var result = await Application.Current.MainPage.DisplayAlert("Settings", "Update camera permissions?", "Yes", "No");
                if (result)
                {
                    CrossPermissions.Current.OpenAppSettings();
                }
            }
        }

        return null;
    }

Best Answer

  • AndrewHerrickAndrewHerrick USMember ✭✭
    Accepted Answer

    Looks like this has been fixed in the latest version of Xamarin (5.4.1) & Forms (2.5.0.91635)

Answers

  • AndrewHerrickAndrewHerrick USMember ✭✭
    Accepted Answer

    Looks like this has been fixed in the latest version of Xamarin (5.4.1) & Forms (2.5.0.91635)

Sign In or Register to comment.