user1511244 user1511244 - 2 years ago 94
iOS Question

How to rotate an image 90 degrees on iOS?

What I want to do is take a snapshot from my camera , send it to a server and then the server sends me back the image on a viewController. If the image is in portrait mode the image appears well on screen , however if the image was taken in landscape mode the image appears streched on the screen(as it tries to appear on portrait mode!). I dont know how to fix this but i guess one solution is first to check if the image is in portrait/landscape mode and then if it is on landscape mode rotate it by 90degrees before showing it on screen.
So how could i do that?

Answer Source
self.imageview.transform = CGAffineTransformMakeRotation(M_PI_2);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download