Tiled Background Image: Can I do that easily with UIImageView?

前端 未结 7 1093
甜味超标
甜味超标 2020-12-07 13:05

I have a fullscreen background image that is tiled, i.e. it has to be reproduced a few times horizontally and vertically in order to make a big one. Like in the browsers on

7条回答
  •  情歌与酒
    2020-12-07 13:44

    I use a variation of @Rivera's solution:

    Put the following in a UIView extension:

    - (void)setColorPattern:(NSString *)imageName
    {
        [self setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:imageName]]];
    }
    

    Then you can set the background pattern in the storyboard/xib file: Image showing how to set the colorPattern in the storyboard/xib

提交回复
热议问题