做视频播放器时,需要根据视图是push还是pop即进栈还是出栈,做视频暂停和记录历史播放的操作。本人即通过判断pop还是push做操作的。
NSArray *viewControllers = self.navigationController.viewControllers;//获取当前的视图控制其 if (viewControllers.count > 1 && [viewControllers objectAtIndex:viewControllers.count-2] == self) { //当前视图控制器在栈中,故为push操作 HJLog(@"push"); [self.playView pause]; _isPush = YES; } else if ([viewControllers indexOfObject:self] == NSNotFound) { //当前视图控制器不在栈中,故为pop操作 HJLog(@"pop"); [SingleTool shareSingleTool].oldButtonTag = 0; [self.playView resetVideoPlayer]; [self appdelegateWithIndex:HJInterfaceOrientationMaskPortrait]; _isPush = NO; }新闻热点
疑难解答