當您拍攝照片時,實際上看不到全尺寸的照片,您只會看到適合顯示屏的部分(照片的分辨率大於iPhone的顯示分辨率)。因此,如果您想拍攝最終圖像並將其全屏顯示,那麼您需要進行一些簡單的計算以縮放圖像,使其比例正確:
// We know the desired resolution. It's full screen (320, 480) or (640, 960).
// Now we want to determine the destination imageView frame with maximum dimensions
// for it to fit the screen AND leave the image's proportions
float minScale = MIN(screenResolution.width/actualImgWidth, screenResolution.height/actualImgHeight);
// With minScale one side will fit full screen, and the other will occupy a bit smaller space than the screen allows
destImgView.bounds = CGRectMake(0, 0, minScale*actualImgWidth, minScale*actualImgHeight);
destImgView.image = actualImg;