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
As I really like Interface Builder I created this UIImageView
subclass to apply tiled backgrounds:
@interface PETiledImageView : UIImageView
@end
@implementation PETiledImageView
- (void)awakeFromNib
{
[super awakeFromNib];
UIImage * imageToTile = self.image;
self.image = nil;
UIColor * tiledColor = [UIColor colorWithPatternImage:imageToTile];
self.backgroundColor = tiledColor;
}
@end
I tried overriding setImage:
but it seems IB doesn't call it when decoding a Nib file.