我使用MPMovieplayer
作为子视图一切正常但我的问题是当我点击全屏视频然后回到小视频帧然后状态栏重叠导航栏
这是我的代码
// Setup player
MPMoviePlayerController* mp =
[[MPMoviePlayerController alloc] initWithContentURL:videoURL];
mpc = mp;
mpc.shouldAutoplay = YES;
[mpc prepareToPlay];
mpc.view.frame = CGRectMake(0, 0, 320, 320);
mpc.backgroundView.backgroundColor = [UIColor redColor];
[self.view addSubview:mpc.view];
答案 0 :(得分:1)
我通过在.plist文件中添加密钥来解决问题
'View controller-based status bar appearance' and set to NO.
然后将状态栏隐藏为NO
答案 1 :(得分:0)
/* Create a new movie player object. */
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
if (player)
{
/* Save the movie object. */
[self setMoviePlrController:player];
/* Register the current object as an observer for the movie
notifications. */
[self installMovieNotificationObservers];
/* Specify the URL that points to the movie file. */
[player setContentURL:movieURL];
/* If you specify the movie type before playing the movie it can result
in faster load times. */
[player setMovieSourceType:sourceType];
[player setRepeatMode:MPMovieRepeatModeNone];
player.scalingMode = MPMovieScalingModeAspectFit;
// Apply the user movie preference settings to the movie player
[self.moviePlrController.view setAutoresizingMask:(UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth)];
[self.playerView addSubview:[self moviePlrController].view];
CGRect frame = self.playerView.frame;
int width = frame.size.width;
int height = frame.size.height;
[[self moviePlrController].view setFrame:CGRectMake(0, 0, width, height)];
}