问题描述:

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;
相关阅读:
Top