Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Media Picker TakePhotoAsync Camera Preview window is not presented in the proper orientation on iPAD #19

Closed
ahmedkhan25 opened this issue Nov 5, 2013 · 6 comments
Assignees
Milestone

Comments

@ahmedkhan25
Copy link

Media Picker TakePhotoAsync Camera Preview window is not presented in the proper orientation on iPAD

When I use this component to setup a picture preview (before taking the picture) the preview window is presented in the wrong orientation BEFORE I take the photo (after taking the picture it is presented correctly)

using this code:

mediaPicker.TakePhotoAsync (new StoreCameraMediaOptions {
              Name = "testPhoto.jpg",
              Directory = "test"
                })
                  .ContinueWith (t => {
                        if (t.IsCanceled || t.IsFaulted)
                            return;

                        ShowPhotoFromCamera (t.Result);
                    }, uiScheduler);

            });
@ermau
Copy link
Member

ermau commented Nov 6, 2013

What version of iOS?

Edit: And which iPad?

@ahmedkhan25
Copy link
Author

iOS 6 and iOS 7 on an iPad2 and iPad Mini

-sorry i closed the issue inadvertently -its still there (reopened)

@ahmedkhan25 ahmedkhan25 reopened this Nov 6, 2013
@ghost ghost assigned ermau Nov 18, 2013
@pauldbau
Copy link

The issue stems from an Apple decree that the underlying UIImagePickerController (which MediaPickerController subclasses) only supports Portrait orientation.
To fix this issue, I added rotation awareness to the MediaPickerPopoverDelegate class, the rotation awareness then applies transforms to the CameraView of the picker.
This transform idea and code is taken from a solution on SO (http://stackoverflow.com/a/19071958/1685090) and it works really well for me.

The code for this fix can be found here:
https://gist.github.com/pauldbau/7669772

Would be great to see this incorporated into the Xamarin.Mobile main, since right now I have to use my own copies of the various internal Xamarin.Mobile classes in my project.

@ermau
Copy link
Member

ermau commented Dec 2, 2013

Well, really the issue stems from the fact that we are not following the (new?) guidance[1] for taking a photo on iPads, which is to use full screen. The real fix is to just correct it so that we are. I don't think this constitutes a breaking chance since you've never really had any UI control when using the async methods anyway.

In the meantime, the workaround is to use the Get*UI method and present it yourself in fullscreen.

  1. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html

@ermau
Copy link
Member

ermau commented Dec 6, 2013

Fixed in 285a3fc

@ermau ermau closed this as completed Dec 6, 2013
@pauldbau
Copy link

pauldbau commented Dec 9, 2013

Thanks mate, works great.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants