代碼:
self.newsImage = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,300,130)];
//set placeholder image or cell won't update when image is loaded
self.newsImage.image = [UIImage imageNamed:@"newsDetail.png"];
//load the image
self.newsImage.imageURL = [NSURL URLWithString:imageBig];
[imageBack addSubview:self.newsImage];
有一個40/40尺寸的圖片,但是imageView的尺寸是300*130。怎麼避免圖片被拉伸?
謝謝
居中內容就可以了:
self.newsImage.contentMode = UIViewContentModeCenter;