setting new properties in category interface/implementation

后端 未结 7 1467
醉梦人生
醉梦人生 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:06

    EDIT: Warning: This property would have a unique value for all the instances of the class.

    This worked for me, but only because I had only one instance of this class in my app.

    #import 
    
    @interface AVAudioPlayer (AstroAVAudioPlayer)
    
    @property (nonatomic) BOOL redPilot;
    
    @end
    
    
    #import "AVAudioPlayer+AstroAVAudioPlayer.h"
    
    @implementation AVAudioPlayer (AstroAVAudioPlayer)
    
    BOOL _redPilot;
    
    -(void) setRedPilot:(BOOL)redPilot
    {
        _redPilot = redPilot;
    }
    
    -(BOOL) redPilot
    {
        return _redPilot;
    }
    
    @end
    

提交回复
热议问题