开发者

MPMoviePlayerView fade in/out of overlay

I've got a MPMoviePlayerViewController, and I've added an overlay as a subview to the MPMoviePlayerController.view that it controls. Does anyone know if there's an easy way to make my added overlay fade in and out with the rest of the controls?

My code to initialize and present the player is:

LandscapeMPVC * theMovieViewController = [[LandscapeMPVC alloc] initWithContentURL:sourceURL];
MPMoviePlayerController * theMoviePlayer = [theMovieViewController moviePlayer];

[theMoviePlayer setRepeatMode:MPMo开发者_运维知识库vieRepeatModeOne]; 
[theMoviePlayer setScalingMode:MPMovieScalingModeAspectFit];
[theMoviePlayer setFullscreen:YES];

// Attemps at overlays
MPViewOverlayController * overlayCont = [[MPViewOverlayController alloc] init];

[[theMovieViewController view] addSubview:overlayCont.view];

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(resetToolbar:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:theMoviePlayer];

[self presentMoviePlayerViewControllerAnimated:theMovieViewController];

LandscapeMPVC is just a subclass of MoviePlayerViewController where I overwrite the orientation code.

When the rest of the controls fade in the movie player, my custom overlay does not. Is there some code in the controller that I need to add, or some notification that is sent?

Any input would be greatly appreciated.


You need to add the controls to the view of the moviePlayer property of the view controller to get them to appear. This will cause the controls to show all the time, but they won't fade.

Like this:

[[theMovieViewController.moviePlayer view] addSubview:overlayCont.view];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜