I'm trying to observe interface orientation by KVO of UIViewController from other object by this code :
[((UIViewController *)self.delegate) addObserver:self forKeyPath:@"interfaceOrientation" options:NSKeyValueObservingOptionNew context:NULL];
and implementing the function :
-(void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context
{
if ([keyPath isEqual:@"interfaceOrientation"])
{
// do something
}
}
The method is called only in the first time , although i can see that the property interfaceOrientation of the delegate change while i rotating the phone .
Why?
Please help !
Thanks!!!!