Add KVO for observing center property from a UIImageView
Add KVO for observing center property from a UIImageView
- Subject: Add KVO for observing center property from a UIImageView
- From: Tales Pinheiro de Andrade <email@hidden>
- Date: Thu, 23 Jun 2011 20:27:30 -0300
Hi again.
I have a custom view (say ECGlassView), subclass from UIImageView, and this view has a subview (say ECNeedleView) that is subclass from UIImageView.
I'm trying to add viewA as observer for viewB center, as I can move viewB above viewA. When I try to tho this:
[self.needle addObserver:self forKeyPath:@"needle.center" options:NSKeyValueObservingOptionNew context:@"needleCenter"];
the program abort, with the message:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ECNeedleView 0x8b1cf30> addObserver:<ECGlassView 0x8b1bac0> forKeyPath:@"needle.center" options:0x1 context:0x21eec] was sent to an object that is not KVC-compliant for the "needle" property.'
In ECGlassView.h I have:
@interface ECGlassView : UIImageView {
ECNeedleView *needle;
}
@property (nonatomic, assign) ECNeedleView *needle;
@end
And have synthesized needle property in ECGlassView.m file.
Even if I try to declare center property in ECNeedleView.h and synthesize it, it doesn't work.
What I'm doing wrong?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden