use*_*064 5 cocoa-touch objective-c key-value-observing avaudioplayer
我试图观察AVAudioPlayer的"currentTime"属性.但是这个方法甚至没有被调用...我需要它来设置UISlider的位置..但它不起作用.这是相关的代码:
[audioPlayer addObserver:self forKeyPath:@"currentTime" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context {
NSLog(@"%@", change);
}
Run Code Online (Sandbox Code Playgroud)
谢谢.