views:

16

answers:

1

I am trying to create a custom UILabel which sets the background colour to clearColor (with added functionality further down the line). This way, I don't have to specify the exact properties for each label as they will be inherent in every instance of the label.

I have tried several variations on a them but with no success, what am I doing wrong?

@interface ABClearLabel : UILabel {
}
@end

and

@implementation ABClearLabel

- (id)init {
    if (self = [super init]) {
        self.backgroundColor = [UIColor clearColor];
    }
}

Unfortunately, this does not work (I have set the label type in IB as ABClearLabel, as have the instance variables and @property declarations). Please help.

A: 

Having played around, IB does it for me - it creates the label with a transparent background. I'm not sure what I had set the previous label to for it not to work. No need for a custom class.

churchill614