iphone – MPMoviePlayerController存在黑色背景
发布时间:2020-12-14 17:18:05 所属栏目:百科 来源:网络整理
导读:我制作iOS应用程序. 我使用MPMoviePlayerController,但这显示黑色背景. 我认为这个问题可以通过这个URL解决,但我无法理解使用方式. MPMoviePlayerController background color won’t stick 我的代码是这样的. NSString *path = [[NSBundle mainBundle] path
我制作iOS应用程序.
我使用MPMoviePlayerController,但这显示黑色背景. 我认为这个问题可以通过这个URL解决,但我无法理解使用方式. 我的代码是这样的. NSString *path = [[NSBundle mainBundle] pathForResource:@"movie_files" ofType:@"m4v"]; NSURL *videoURL = [NSURL fileURLWithPath:path]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL]; //setting moviePlayer.scalingMode =MPMovieScalingModeAspectFit; moviePlayer.controlStyle=MPMovieControlStyleDefault; moviePlayer.shouldAutoplay=NO; [moviePlayer.view setFrame:CGRectMake(20,20,280,200)]; //notification [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; //clearColor UIView *subV =[[UIView alloc]init]; for(subV in moviePlayer.backgroundView.subviews) { subV.backgroundColor = [UIColor clearColor]; } [moviePlayer.view addSubview:subV]; [self.view addSubview:moviePlayer.view]; //show white screen 请告诉清楚的背景方式. 解决方法
您需要将其更改为:
moviePlayer.backgroundView.backgroundColor = [UIColor clearColor]; for(UIView *aSubView in moviePlayer.view.subviews) { aSubView.backgroundColor = [UIColor clearColor]; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ajax – Access-Control-Allow-Headers不允许使用chrome:C
- Oracle10g 安装方法
- flex打印系列教程四 理解FlexPrintJob
- swift – 没有这样的模块错误
- swift3 – Swift 3 Xcode 8 – SwiftValue encodeWithCoder
- C#开发自动照片(图片)裁剪(缩放)工具
- cocos2dx[3.2](11)——新回调函数std::bind
- postgresql以及mysql的数据导出导入到文件
- xcode – 检测蓝牙耳机是否连接到Apple Watch
- iphone – 通过/共享数据的方式有多少种b / w视图控制器