kvo , key value observer script

in swipeView:

pair set:
– willChangeValueForKey:
– didChangeValueForKey:

or call this
- setValue:forKey:

[self.swipeView addObserver:self
                 forKeyPath:@"currentItemIndex"
                    options:NSKeyValueObservingOptionNew
                    context:nil];

self 個到有

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
     NSLog(@"hi"); 
}