Question

I'm looking to change the phone's rotation based on the size of an image. is there a way to detect if the image has 480px x 300px dimensions then use landscape rotation and vice versa?

I have many photos some of which are best view landscape and other best viewed in portrait mode.

thanks for any help.

Was it helpful?

Solution

Think hard about whether you want to rotate the whole UIView that the image is on, versus just doing a rotation transform on the image, so it's turned 90 degrees inside a view that's still portrait mode. When I came up against this issue myself recently, I chose the latter. The whole rest of my app is locked in portrait mode, and to have this one view re-orient its whole thing to be landscape was just weird. Instead I float the image out in a UIView up on top of everything else, and rotate it if that's the best-fit orientation of the image.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top