0

전환을 추가하는 방법을 알고 싶습니다 (비디오가 시작될 때 페이드 인하 고 비디오가 끝나면 페이드 아웃).moviePlayBackDidFinish 및 전환 효과

이 작업에 그를 도와 주 시겠어요, 나는 종류의 전환으로 잃었어요, 결코/전에 그것으로 재생할 수 없습니다 : 여기

당신은의 스크린 샷을 캡처 할 수있는 내 코드

- (void) startSlideShow 
{ 
    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] 
             pathForResource:@"2" ofType:@"mov"]]; 


    MPMoviePlayerController *moviePlayer = 
    [[MPMoviePlayerController alloc] initWithContentURL:url]; 

    [[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(moviePlayBackDidFinish:) 
               name:MPMoviePlayerPlaybackDidFinishNotification 
               object:moviePlayer]; 
    moviePlayer.view.frame = CGRectMake(0, 0, 768, 1024); 

    moviePlayer.controlStyle = MPMovieControlStyleDefault; 
    moviePlayer.shouldAutoplay = YES; 
    [self.view addSubview:moviePlayer.view]; 
    [moviePlayer setFullscreen:YES animated:YES]; 
    } 


-(void)moviePlayBackDidFinish: (NSNotification*)notification 
{ 
    MPMoviePlayerController *moviePlayer = [notification object]; 

    [[NSNotificationCenter defaultCenter] removeObserver:self  
                name:MPMoviePlayerPlaybackDidFinishNotification 
                object:moviePlayer]; 

    if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) 
    { 
     // the transition should be around here... (fade out) 
     [moviePlayer.view removeFromSuperview]; 
    } 
    [moviePlayer release]; 

    [self checkResources]; 
} 

답변

0

입니다 동영상을 재생하기 직전의 UI.

UIGraphicsBeginImageContext(view.frame.size); 
[view.layer renderInContext:UIGraphicsGetCurrentContext()]; 
UIImage *screenshotOfView = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 

당신이 당신의 MoviePlayer를 추가보다 당신이 그 위에있는 UIImageView로 이미지를 추가하는 것보다 (예 : [[UIApplication sharedApplication] keyWindow). 당신이 이미지를 희미 해지는 것보다.

(0-1의 moviePlayer.view.alpha에도 애니메이션을 적용 할 수 있는지 여부는 알 수 없습니다.)

기본 fadein/페이드 아웃

는 알파 값 애니메이션에 의해 달성 될 수있다 :

view.alpha = 0.0; 
[UIView animateWithDuration: 0.35 animations:^{ 
    view.alpha = 1.0; 
}]; 
+0

내가 그것을 얻을하지 않습니다를 ... 내가 원하는 그것은 인/아웃 효과에 페이드를 적용 할 때 비디오/이미지 시작될 것입니다. 나를 도와 주셔서 고마워! – user1256827

+0

기본적인 페이드 인/페이드 아웃은 알파 값에 애니메이션을 적용하여 얻을 수 있습니다. 나는 내 대답을 편집 할 것이다. – calimarkus