-(voID)playMovIE:(NSURL *)url{ movIEPlayer = [[MPMovIEPlayerController alloc] initWithContentURL:url]; if (IdioM==IPAD) { [movIEPlayer.vIEw setFrame:CGRectMake(22,100,720,300)]; } else { (IS_IPHONE_5)? [movIEPlayer.vIEw setFrame:CGRectMake(22,70,280,150)]:[movIEPlayer.vIEw setFrame:CGRectMake(22,40,260,140)]; } [_scrollVIEw addSubvIEw:movIEPlayer.vIEw]; movIEPlayer.scalingMode =MPMovIEScalingModeFill; [movIEPlayer preparetoPlay]; [movIEPlayer play]; [[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(movIEPlayerDIDEnterFullscreen:) name:MPMovIEPlayerDIDEnterFullscreenNotification object:Nil]; [[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(movIEPlayerDIDExitFullScreen:) name:MPMovIEPlayerDIDExitFullscreenNotification object:Nil];}-(voID)movIEPlayerDIDEnterFullscreen :(ID)sender{ NSLog(@"fullscreen"); [movIEPlayer play]; movIEPlayer.scalingMode =MPMovIEScalingModeFill;}- (voID) movIEPlayerDIDExitFullScreen:(ID)sender { NSLog(@"exit full screen"); [movIEPlayer play]; movIEPlayer.scalingMode =MPMovIEScalingModeFill;}
这里当我最初播放视频时将处于“MPMovIEScalingModeFill”模式…但我的问题是如果我按全屏它会在全屏显示视频..当我按退出“全屏”然后我的视频模式转到“MPMovIEScalingModeAspectFit “mode.but我需要始终处于”MPMovIEScalingModeFill“模式.我的代码出错了.请帮帮我……
解决方法 我相信这会生成MPMovIEPlayerScalingModeDIDChangeNotification.[[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(movIEScalingModeDIDChange:) name:MPMovIEPlayerScalingModeDIDChangeNotification object:nil];
资料来源:Apple Doc
MPMovIEPlayerScalingModeDIDChangeNotification
在电影播放器的缩放模式发生变化时发布.没有userInfo字典.缩放模式可以通过编程或用户交互进行更改.要设置或检索影片播放器的缩放模式,请访问其scalingMode属性.状态已更改的电影播放器可用作与通知关联的对象.
总结以上是内存溢出为你收集整理的ios – 退出全屏后MPMoviePlayerController缩放模式问题全部内容,希望文章能够帮你解决ios – 退出全屏后MPMoviePlayerController缩放模式问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)