- 先设定图片让UIImageView有个frame
UIImageView *earnPic = [[UIImageView alloc]initWithImage:IMGWithName(@"yujizuangbg")];
- 然后根据图片的高来拉伸它的宽
CGFloat imgHeight = self.earnPic.frame.size.height;
self.earnPic.frame = CGRectMake(self.title_lab.wgLeft, self.title_lab.wgBottom+12*kFixRax, 112*kFixRaxW, imgHeight);
UIImage *earnNewImage = [self.earnPic.image resizableImageWithCapInsets:UIEdgeInsetsMake(0*kFixRaxW,112*kFixRaxW,imgHeight,0) resizingMode:UIImageResizingModeStretch];
self.earnPic.image=earnNewImage;
反之亦然,具体情况具体分析吧!
网友评论