문제

Is it possible to show a UIImage in a UIImageView such that the image is both, scaled and tiled?

for example, it should be scaled at 2 times it's actual resolution, but tiled across the full size of the UIImageView.

Is this doable?

도움이 되었습니까?

해결책

This should work :

UIImage *image = [UIImage imageNamed:@"tile"];
UIImage *newImage = [UIImage imageWithCGImage:[image CGImage] scale:0.5 orientation:image.imageOrientation];
[self.myImageView setBackgroundColor:[UIColor colorWithPatternImage:newImage]];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top