Trong dự án của tôi, tôi đã tạo ra một ViewController và tạo ra một lớp là "AVPlayerViewController" để hiển thị video.AVPlayerViewController - Không có bố cục tự động - Không thể đồng thời đáp ứng các ràng buộc.
Mã hoạt động và tôi có thể xem video tuy nhiên, tôi nhận được một số cảnh báo ràng buộc trong bảng điều khiển.
Dự án của tôi đang hoạt động mà không có AutoLayout và tôi sử dụng tính năng Tự động hóa. Tôi đã thử mã:
self.view.translatesAutoresizingMaskIntoConstraints = false
nhưng cảnh báo sẽ không biến mất và điều khiển của trình phát video sẽ di chuyển lên đầu màn hình.
cảnh báo Có:
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x1475c4540 h=-&- v=-&- _UIBackdropContentView:0x147443880.width == _UIBackdropView:0x147436a30.width>",
"<NSLayoutConstraint:0x1475b38f0 H:|-(0)-[_UIBackdropView:0x147436a30] (Names: '|':UIView:0x1474368d0)>",
"<NSLayoutConstraint:0x1475b3980 H:[_UIBackdropView:0x147436a30]-(0)-| (Names: '|':UIView:0x1474368d0)>",
"<NSLayoutConstraint:0x1475b3650 H:|-(0)-[UIView:0x1474368d0] (Names: '|':AVAlphaUpdatingView:0x14744db30)>",
"<NSLayoutConstraint:0x1475b36d0 H:[UIView:0x1474368d0]-(0)-| (Names: '|':AVAlphaUpdatingView:0x14744db30)>",
"<NSLayoutConstraint:0x1475c7670 H:|-(15)-[UIView:0x1474435c0](LTR) (Names: '|':_UIBackdropContentView:0x147443880)>",
"<NSLayoutConstraint:0x1475c54d0 UIView:0x147443b40.right == _UIBackdropContentView:0x147443880.right>",
"<NSLayoutConstraint:0x1475c7a40 UIView:0x1474435c0.right == UIView:0x147443b40.left - 10>",
"<NSLayoutConstraint:0x1475c4da0 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x14744db30(0)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1475b3980 H:[_UIBackdropView:0x147436a30]-(0)-| (Names: '|':UIView:0x1474368d0)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Bất cứ ý tưởng phải làm gì?
@Jamesh Tôi đã thử với cùng thêm một suvView và thêm playerView bên trong nó nhưng lỗi có vẻ giống nhau. Tôi đang sử dụng xcode 8.2 và ios 10 bất kỳ trợ giúp nào sẽ được đánh giá cao. –
Bạn phải chứng minh đó là những gì bạn đang làm bằng cách đăng mã mẫu. –