Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images at bottom of view when device is flat. #19

Open
parkej60 opened this issue Jan 29, 2014 · 4 comments
Open

Images at bottom of view when device is flat. #19

parkej60 opened this issue Jan 29, 2014 · 4 comments
Labels

Comments

@parkej60
Copy link

For some reason when I load the photo browser and my device is laying flat on a table the images will show up at the bottom of the view and the title and description will be chopped off. If I tilt the device towards me, so it is more vertical, the images center.

Just thought I'd post this to see if anyone else can replicate.

@parkej60
Copy link
Author

It seems as if the device orientation is set as UIDeviceOrientationFaceUp. The setFrame function in AGPhotoBrowserCell doesn't take this orientation into consideration so the size never gets set.

Tweaked this code to check for that orientation as well and it seems to fix the problem somewhat.

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (UIDeviceOrientationIsPortrait(orientation) || UIDeviceOrientationIsLandscape(orientation) || orientation == UIDeviceOrientationFaceUp) {
if (UIDeviceOrientationIsPortrait(orientation) || orientation == UIDeviceOrientationFaceUp) {
correctFrame.size.width = CGRectGetHeight([[UIScreen mainScreen] bounds]);
correctFrame.size.height = CGRectGetWidth([[UIScreen mainScreen] bounds]);
} else {
correctFrame.size.width = CGRectGetWidth([[UIScreen mainScreen] bounds]);
correctFrame.size.height = CGRectGetHeight([[UIScreen mainScreen] bounds]);
}
}

@andreagiavatto
Copy link
Owner

Thanks, i'll have a look at the issue and your fix soon.

@andreagiavatto
Copy link
Owner

I received another report for this bug and you are right i was not handling the orientation correctly when the device is laying flat on a surface. Your proposal for a fix is (part of) the solution i'll include in the next update, thanks!

@oleksandr
Copy link

I'm experiencing the similar issue in the following scenario:

  1. My app does not support landscape orientation (enabled only portrait up mode)
  2. Before tapping an image to present the view I turn the device into landscape and then tap the image
    3.The browser's view is presented: image shifted down and left, the overlay is messed to the right (wrong dimensions)

andreagiavatto added a commit that referenced this issue Apr 18, 2014
fixed orientation issues when device is laying flat on a surface #19, co...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@oleksandr @andreagiavatto @parkej60 and others