简体   繁体   English

将大小为10x10的UIImageView设置为UIView的背景

[英]Set UIImageView with size 10x10 as background for UIView

I have image with size 10x10 px and I need to set the image as background for UIView with the image copied horizontally and vertical, not stretched. 我的图像尺寸为10x10像素,我需要将图像设置为UIView的背景,并且水平和垂直复制图像,而不拉伸图像。 Is it possible to do with ios? ios有可能吗?

you can do it like this: 您可以这样做:

view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bodyBG"]];

It copied horizontally and vertical in default. 默认情况下,它是水平和垂直复制的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM