我有一个要求,我有一个使用MPMediaPlayerController
. 除了视频,我还有两个按钮,我需要在单击按钮时捕获当前播放时间并单独存储所有相关的点击。我可以使用返回的“currentPlaybackTime”属性获取视频的当前播放时间NSTimeInterval
。但是有人可以帮助我如何将所有NSTimeInterval
值存储到NSMutableDictionary
. 我尝试了以下方法:
-(void)onClickOfGood {
NSLog(@"The current playback time in good:%g",moviePlayerController.currentPlaybackTime);
currentPlaybackTime = moviePlayerController.currentPlaybackTime;
//NSArray *arrayContainsGoodClicks = [[NSArray alloc]initWithObjects:currentPlaybackTime, nil ];
NSNumber *goodTimeIntervals = [NSNumber numberWithDouble:currentPlaybackTime];
NSMutableArray *arrayContainsGoodClicks = [[NSMutableArray alloc]initWithObjects:goodTimeIntervals,nil ];
NSLog(@"The total count of Array is: %i",[arrayContainsGoodClicks count]);}
但是每次单击好按钮后,我都会将数组计数为 1。有人可以指出我哪里出错了吗?