I have an image pattern which I want to display in a UIImageView. The UIImageVIew’s size is determined by user-entered text, so its height will change. Is there a way to “cascade” the image pattern, so that it will repeat down the entire height of the UIImageView? In theory I could build a super-tall image in Photoshop, and hope that the image view doesn’t get extended past a certain point, but I know that having a basic pattern and repeating it is the smart way to do it. However, I can’t find anything related to this in Interface Builder. Is this possible to do, and if so, how can I accomplish it?
Practice As Follows
You should be able to accomplish this with a plain
UIView. Create a UIColor from the image (this makes a “pattern image”, which can be tiled:
UIColor *patternColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"pattern"]];
Then set the background color of the view like so:
view.backgroundColor = patternColor;
I’d run this code in the
viewWillAppear methods of the view’s controller.