私は@propertyを作成し、それを合成し、ゲッターとセッターを作成するだけでなくのような場合: @propertyとセッターとゲッター
#import <UIKit/UIKit.h>
{
NSString * property;
}
@property NSString * property;
--------------------------------
@implementation
@synthesize property = _property
-(void)setProperty(NSString *) property
{
_property = property;
}
-(NSString *)property
{
return _property = @"something";
}
が、私はこの呼び出しと仮定して修正アム
-(NSString *)returnValue
{
return self.property; // I know that this automatically calls the built in getter function that comes with synthesizing a property, but am I correct in assuming that I have overridden the getter with my getter? Or must I explicitly call my self-defined getter?
}
はこの呼び出しと同じですか?
-(NSString *)returnValue
{
return property; // does this call the getter function or the instance variable?
}
はこの呼び出しと同じですか?
-(NSString *)returnValue
{
return _property; // is this the same as the first example above?
}
:手動 '定義している場合は、' @syntehsize property'は必要ありません - (無効)のsetProperty:(NSStringの*) 'と' - (NSStringの*)property'。 –
しかし、プロパティを作成すると、xCodeはそのプロパティが合成されなければならないという警告を私に与えます。 – iggy2012