2013-03-17 62 views
0

我遇到了一个问题:我正在成功从一个视图转换到下一个视图 - 从包含静态图像的视图到包含视频的视图(mov或mp4 ,等使用AVPlayer),反之亦然或任何其他类型的序列。加载新视图后仍旧听到旧视图的声音

但是,当我从包含视频的视图转换为包含图像的视图时,我仍然在加载图像后听到视频的声音。奇怪。最有趣的是,当我从视频转换到视频时,它不会发生......任何想法的家伙?

请查看我使用转型视图的代码(有溶解作用):

- (void) replaceView: (UIView *) theCurrentView withView: (UIView *) theReplacementView 
{ 

    theReplacementView.alpha = 0.0; 
    [self.view addSubview: theReplacementView]; 

    [UIView animateWithDuration: 1.5 
        animations:^{ 
         theCurrentView.alpha = 0.0; 
         theReplacementView.alpha = 1.0; 
        } 
        completion:^(BOOL finished) { 
         [theCurrentView removeFromSuperview]; 
        }]; 


    self.currentView = theReplacementView; 
    [self.view addSubview:theReplacementView]; 
} 

回答

0

尽量明确地停在viewWillDisappear方法的视频播放。

+0

在viewWillDisappear中不起作用,但实际上,如果我在“theReplacementView.alpha = 1.0;”之后放置一行,像这样: theReplacementView.alpha = 1.0; [avPlayer pause]; – Armand 2013-03-17 17:18:34

相关问题