I know this is a newbie question but i can’t get my head around this (or really, i can’t get it working)
so i have in my .h
@interface
NSString *test;
@end;
@property NSString *test
and in my .m
...
@synthesize test;
...
but i want a custom setter for test – what is the correct syntax?
thanks
First, you do not need to declare a variable
testif you plan to@synthesize, but if you do, you need to put it in curly braces.Second, the declaration of the property needs to be inside the interface:
Finally, the syntax for the setter is
If you choose to override the getter as well, the convention is