setting new properties in category interface/implementation

后端 未结 7 1512
醉梦人生
醉梦人生 2020-12-03 03:42

Ok, so I have this, but it wont work:

@interface UILabel (touches)

@property (nonatomic) BOOL isMethodStep;

@end


@implementation UILabel (touches)

-(BOO         


        
7条回答
  •  情书的邮戳
    2020-12-03 04:17

    A solution that I found to this was to just give each object that you want flagged a unique tag.

    I made a UILabel category to add custom fonts to all my labels but on some i wanted them to be bold so i did this ->

    - (void) layoutSubviews {
        [super layoutSubviews];
        [self addCustomFont];   
    }
    
    - (void) addCustomFont {
        if (self.tag == 22) {
            [self setFont:[UIFont fontWithName:SEGOE_BOLD size:self.font.pointSize]];
        }else{
            [self setFont:[UIFont fontWithName:SEGOE_LIGHT size:self.font.pointSize]];
        }
    }
    

提交回复
热议问题