【发布时间】:2016-08-23 11:12:07
【问题描述】:
我一直在像这样以编程方式添加AVPlayerViewcontroller
playerViewController = [[AVPlayerViewController alloc]init];
playerViewController.view.frame = CGRectMake(40,60, 500, 700);
playerViewController.showsPlaybackControls=YES;
[self.view addSubview:playerViewController.view];
我收到了很多限制警告
> <NSAutoresizingMaskLayoutConstraint:0x14defa560 h=-&- v=-&- _UIBackdropContentView:0x14deae530.width == _UIBackdropView:0x14deab370.width>",
"<NSLayoutConstraint:0x14dee1b70 H:|-(14)-[UILabel:0x14dee0ea0'Hi-Speed Scrubbing'] (Names: '|':_UIBackdropContentView:0x14deae530 )>",
"<NSLayoutConstraint:0x14dee1bf0 H:[UILabel:0x14dee0ea0'Hi-Speed Scrubbing']-(14)-| (Names: '|':_UIBackdropContentView:0x14deae530 )>",
"<NSLayoutConstraint:0x14dee1670 H:|-(0)-[_UIBackdropView:0x14deab370] (Names: '|':UIView:0x14deab090 )>",
"<NSLayoutConstraint:0x14dee16f0 H:[_UIBackdropView:0x14deab370]-(0)-| (Names: '|':UIView:0x14deab090 )>",
"<NSLayoutConstraint:0x14dee1330 H:|-(0)-[UIView:0x14deab090] (Names: '|':AVAlphaUpdatingView:0x14deaaad0 )>",
"<NSLayoutConstraint:0x14dee13b0 H:[UIView:0x14deab090]-(0)-| (Names: '|':AVAlphaUpdatingView:0x14deaaad0 )>",
"<NSLayoutConstraint:0x14defb080 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x14deaaad0(0)]>"
我也尝试过给予
playerViewController.view.translatesAutoresizingMaskIntoConstraints = NO
我仍然遇到约束问题。谁能给我一个解决方案?
【问题讨论】:
-
您确定只有在将 playerViewController 添加到视图层次结构后才会收到约束警告。
标签: ios objective-c nslayoutconstraint ios-autolayout avplayerviewcontroller