iOS: Adding observer to a UIView's frame.origin.y? -


i'm trying monitor , react changing value of origin of uiview's frame. code:

[cell.bottomview addobserver:self forkeypath:@"frame.origin" options:nskeyvalueobservingoptionnew context:null];  -(void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context {     nslog(@"%@ changed", keypath); } 

i'm getting following error message don't understand:

an instance 0x7587d10 of class nsconcretevalue deallocated while key value observers still registered it. observation info leaked, , may become mistakenly attached other object. set breakpoint on nskvodeallocatebreak stop here in debugger. here's current observation info: <nskeyvalueobservationinfo 0x7587fd0> ( <nskeyvalueobservance 0x7587f70: observer: 0x7587bd0, key path: origin, options: <new: yes, old: no, prior: no> context: 0x0, property: 0x7587ff0> ) 

really, i'm interested in y position of origin code won't compile if set keypath "frame.origin.y".

if set keypath "frame", there no errors method observevalueforkeypath never gets called. guess change frame's origin doesn't count change frame..?

how accomplish adding observer uiview's frame.origin.y ?

although not solve problem in way wanted, have found out able add observers correctly uiview's center. monitoring center of view can determine frame's origin has changed.

[cell.bottomview addobserver:self forkeypath:@"center" options:nskeyvalueobservingoptionnew context:null]; 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -