self.subscription = [[[RACObserve(photoModel, fullsizedData) filter:^BOOL(id value) {
return value != nil;
}]map:^id(id value) {
return [NSNumber numberWithFloat:1.0f];
} ]setKeyPath:@keypath(self.imageView.layer,borderWidth)onObject:self.imageView];
错误日志是:
Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<UIImageView 0x7b1a8510> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key cornerRadius.
并且我认为如果有另一种方式来反应值类型是浮点数,int等等.i会接受它
答案 0 :(得分:3)
您应该使用字符串而不是@keypath
宏。
[... setKeyPath:"layer.borderWidth" onObject:self.imageView];
或者您可以使用更清晰的RAC宏。
RAC(self.imageView, layer.borderWidth)
= [[RACObserve(photoModel, fullsizedData) filter:^BOOL(id value) {
return value != nil;
}] map:^id(id value) {
return @1.0f;
}];