I want to repeat the following image:
to achieve the following background:
I tried a few codes as follow:
bluePatternView.backgroundColor = [UIColor colorWithPatternImage:
[[UIImage imageNamed:@"blue_pattern.png"] stretchableImageWithLeftCapWidth:0 topCapHeight:0]];
and:
bluePatternView.backgroundColor =
[[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"blue_pattern.png"]];
I also tried to draw image with CGContextDrawTiledImage with no success.
How that can be done?!
EDIT: result of implementing luk2302. please give him recognition by upvoting
bluePatternView.backgroundColor =
[UIColor colorWithPatternImage:[UIImage imageNamed:@"blue_pattern.png"]];
result:
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…