AVPlayerViewController全屏发出约束警告

时间:2016-01-04 11:58:18

标签: ios objective-c nsautolayout avplayerviewcontroller

我正在尝试在屏幕中间创建一些带有标签和电影的UIViewController。对于电影,我使用AVPlayerViewController但是,每当我点击其全屏按钮时,即使我从代码创建AVPLayerViewController,我也会收到几个约束警告,使用CGRect来定义其边界或者如果我使用故事板将其嵌入到ContainerView中。

当我不依赖于故事板时,这是我正在使用的代码:

NSString *path = [[NSBundle mainBundle] pathForResource:@"video_1" ofType:@"3gp"];


NSURL *movieURL = [NSURL fileURLWithPath:path];


AVPlayer *player = [AVPlayer playerWithURL:movieURL];
AVPlayerViewController *playerViewController = [AVPlayerViewController new];
playerViewController.player = player;


[self addChildViewController:playerViewController];


[self.view addSubview:playerViewController.view];


playerViewController.view.frame = CGRectMake(100, 100, 640, 480);


[player play];

有谁知道如何修复约束问题?

谢谢

0 个答案:

没有答案