开发者

Is it possible to add multiple images in a single uiimageview?

开发者 https://www.devze.com 2023-02-01 07:22 出处:网络
I have an imageview in which I want an image to be set. My desi开发者_运维知识库gner have given me an image which is of the same height of imageview but the width is 1/10th of the imageview. He asked

I have an imageview in which I want an image to be set. My desi开发者_运维知识库gner have given me an image which is of the same height of imageview but the width is 1/10th of the imageview. He asked me to repeat it inside the imageview like a texture.

Is it possible to add multiple images to an imageview? I know I can do it by using 10 imageviews for each reptition. Is there anyother way like the texture thing?


Important Edit:

While the answer below is correct, I answered this too literally and didn't suggest the appropriate alternative.

A UIImageView can only have one image, but you can fill a UIView with a repeating pattern by using UIColor's colorWithPatternImage method:

// myView is the UIView to fill
// myImage is the UIImage to use as a fill pattern

myView.backgroundColor = [UIColor colorWithPatternImage:myImage];

Old Answer

No, only one UIImage per UIImageView. Your designer should repeat it himself and give you an image of the appropriate size. The iPhone is not the web, requirements are different.

0

精彩评论

暂无评论...
验证码 换一张
取 消