IOS: insert a photo from camera in a UIImageView
In my app I use a cust开发者_JAVA百科om camera and when I snap a photo I want to see it in an UIImageView
, it's all ok it work, but there is a little problem: when it put the UIImage
(from camera) in UIImageView
, the image sems a little flattened, then what's the exactly resolution that I should to set for UIImageView
to have an exactly copy of my original UIImage?
ok, I set aspect fill in IB and it's all ok
The images resolution depends on the device that you are using. For the iPhone 4, it's 2592x1936.
I think it's more likely that you might be looking for the aspect ratio for the image, which is always 4:3. Keep in mind however, that a) you don't know whether the image will be portrait or landscape and b) that, if you allow to take an image from a photo album, you don't have control over the resolution/ratio at all.
So the most prudent thing to do might be to just set the UIImages fill mode to 'Aspect Fill' or 'Aspect Fit'.
精彩评论