当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone - How to fit uiimage from camera after cropping?

问题描述:

Hello everyone I am taking a photo from camera or photo library. I have a crop function that will crop the image to 1280 * 520 pxs. I have a uiimageview which width is 320 * 130 pxs. The problem I am facing is that its not fitting the uiimageview fully. I can see blank spaces on top and bottom.

网友答案:

Sample Code :

[imageView setContentMode:UIViewContentModeTopLeft];
[imageView setClipsToBounds:YES];

Content Modes : Look at Documetation

typedef enum {
   UIViewContentModeScaleToFill,
   UIViewContentModeScaleAspectFit,
   UIViewContentModeScaleAspectFill,
   UIViewContentModeRedraw,
   UIViewContentModeCenter,
   UIViewContentModeTop,
   UIViewContentModeBottom,
   UIViewContentModeLeft,
   UIViewContentModeRight,
   UIViewContentModeTopLeft,
   UIViewContentModeTopRight,
   UIViewContentModeBottomLeft,
   UIViewContentModeBottomRight,
} UIViewContentMode;
分享给朋友:
您可能感兴趣的文章:
随机阅读: