0
我想知道如何添加一個轉換(當視頻開始時淡入淡出,視頻結束時淡出)。moviePlayBackDidFinish和Transition的效果
你能幫他完成這項任務,我有點失去了轉型,從來沒有與它之前播放/:
這裏是我的代碼
- (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];
}
我不明白這一點......我想它是什麼/淡出效果應用淡入時,視頻/圖像即將開始。感謝幫助我的男人! – user1256827 2012-03-09 10:47:25
通過爲alpha值設置動畫可以實現基本的淡入/淡出。我會編輯我的答案。 – calimarkus 2012-03-09 11:03:49