显然,对于obj-c,通常没有理由编写getter和setter(感谢有用的mr@synthesize)。所以现在,需要这样做,我遇到了我不知道如何编写它们的问题。:p我确定我可能不会以正确的方式解决我的问题-将我的对象子类化会容易得多-但我正在尝试编写类别代码来添加属性,因为(在开始)它更快,因为我想学习如何在我的应用程序中使用类别代码。我有这个:-(BOOL)isMethodStep{returnself.isMethodStep;}-(void)setIsMethodStep:(BOOL)theBoolean{if(self.isMethodStep!=theBoolean){s
好的,我有这个,但它不起作用:@interfaceUILabel(touches)@property(nonatomic)BOOLisMethodStep;@end@implementationUILabel(touches)-(BOOL)isMethodStep{returnself.isMethodStep;}-(void)setIsMethodStep:(BOOL)boolean{self.isMethodStep=boolean;}-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{if(self.isMet
好的,我有这个,但它不起作用:@interfaceUILabel(touches)@property(nonatomic)BOOLisMethodStep;@end@implementationUILabel(touches)-(BOOL)isMethodStep{returnself.isMethodStep;}-(void)setIsMethodStep:(BOOL)boolean{self.isMethodStep=boolean;}-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{if(self.isMet