我正在使用 Core Data,并且想在设置属性时运行一些自定义代码。
@interface FTRecord : NSManagedObject
@property (nonatomic) NSTimeInterval timestamp;
@implementation FTRecord
@dynamic timestamp;
-(void)setTimestamp:(NSTimeInterval)newTimestamp
{
//run custom code....
//and now how to pass the value to the actual property?
[self setTimestamp:newTimestamp];
}
在这种情况下,我为时间戳属性定义了设置器主体。但是如何设置属性的值而不遇到递归循环呢?