In my view controller's header file I've created a property:
@property(nonatomic) BOOL hasPhoto;
In my implementation file, I want to override its setter, hence:
-(void)setHasPhoto:(BOOL)hasPhoto{
_hasPhoto = hasPhoto;
if(hasPhoto){
//do something
}
}
However, when I try to compile, Xcode doesn't see the backing variable, which should be named _hasPhoto
and doesn't compile. If I synthesize it manually:
@synthesize hasPhoto = _hasPhoto;
It works. What am I doing wrong?