ios - Infinite Loop Event Handler Pairs -


i have 2 views have event handler in delegates called time interaction occurs. in each event hander i'd performs interaction on other view. issue here run infinite loop of , forth calls on event handlers i.e. when 1 interaction on other, triggers event handler, , on. there way around this?

here delegate method. view1 , view2 2 views. position custom class used update positions of each view.

-(void) viewdelegate: (uiview*) dview didchangeposition: (position*) newposition {     if( dview == view1 ){         [view2 movetoposition: newposition];     }else{         [view1 movetoposition: newposition];     }  }  

at beginning of viewdelegate:didchangeposition: save delegate of view1 and/or view2 local variables, , nil out actual delegate properties. can freely call movetoposition: or other code generate delegate callback. @ end of method restore delegates saved values.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -