2
私はこのmanagedObject
のサブクラスを持っています。位置はNSPointの位置です。 XIBでは、私はこのNSPointを含むNSValueにバインドの問題
つの表示position.x値やその他の表示position.yのような2 NSTextFieldをしたいです。私は、このエラー::だから私がチェック
[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key x.
を得る「selection.position.x」と
フレーム
管理NSArrayControllerはの「selection.position.y」キーパスにNSTextFieldをバインドしようとしましたKVC:-(void)awakeFromInsert
で
Frame.h
@interface Frame : NSManagedObject {
@private
}
@property (nonatomic, retain) NSNumber * order;
@property (nonatomic, retain) NSNumber *visible;
@property (nonatomic, retain) NSValue *position;
@property (nonatomic, retain) NSNumber *scale;
@property (nonatomic, retain) Sprite *sprite;
@property (nonatomic, retain) Resource *resource;
//test
@property (nonatomic, retain) NSValue *frame;
@end
私はこのコードを試してみてください。
-(void)awakeFromInsert
{
[super awakeFromInsert];
self.position = [NSValue valueWithPoint:NSPointFromCGPoint(CGPointZero)];
//[self.position setValue:[NSNumber numberWithFloat:50.0f] forKey:@"x"];
[self setValue:[NSNumber numberWithFloat:1.0f] forKeyPath:@"scale"];
[self setValue:[NSNumber numberWithFloat:10.0f] forKeyPath:@"frame.origin.x"];
[self setValue:[NSNumber numberWithFloat:10.0f] forKeyPath:@"position.x"];
}
最初とs econd KVC setValueのは、任意のヘルプは感謝している理由、私は理解していない
[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key x.
上記と同じメッセージを持つ第三のクラッシュに動作します。