2
回答
iOS executing本来是readonly,为什么可以重写成readwrite,不合乎常理啊,为什么?
终于搞明白,存储TCO原来是这样算的>>>   

executing本来是readonly,为什么可以重写成readwrite,不合乎常理啊,为什么?


@interface MyOperation()

@property (assign, nonatomic, getter = isExecuting) BOOL executing;

@property (assign, nonatomic, getter = isFinished) BOOL finished;

@property(nonatomic, strong) NSURLRequest *request;

@property(nonatomic, strong) NSURLSession *session;

@property(nonatomic, strong) NSString *threadName;

@end

@implementation MyOperation

@synthesize executing = _executing;

@synthesize finished = _finished;


- (void)setFinished:(BOOL)finished {

    [self willChangeValueForKey:@"isFinished"];

    _finished = finished;

    [self didChangeValueForKey:@"isFinished"];

}

- (void)setExecuting:(BOOL)executing {

    [self willChangeValueForKey:@"isExecuting"];

    _executing = executing;

    [self didChangeValueForKey:@"isExecuting"];

}


举报
gaoyuqiang30_1
发帖于2年前 2回/1K+阅
顶部