Trong ứng dụng của tôi, tôi có tùy chỉnh tableViewCells với tỷ lệ cố định (16x9). Để đạt được điều đó, tôi đặt một khung nhìn trong ô, cố định nó vào khung nhìn cha mẹ của nó (mặc dù tôi đã làm nó trong trình xây dựng giao diện: V/H:|-[innerView]-|
). Ngoài ra, tôi đặt một ràng buộc tỷ lệ vào nó.UITableViewAutomaticDimension không hoạt động bình thường trong iOS 9
Trong bảng của tôiViewController Tôi đang sử dụng UITableViewAutomaticDimension
làm chiều cao ô bảng.
Chiều cao hàng ước tính là 180, đó là kích thước chính xác mà ô sẽ có trên màn hình rộng 320px (như tôi, như bạn có thể thấy, thực hiện).
Tôi vẫn đang triển khai 8.4, nhưng khi chạy dự án trên Thiết bị có iOS 9, tôi nhận được rất nhiều cảnh báo bố cục tự động, mặc dù mọi thứ hoạt động tốt và trông hoàn hảo.
Cảnh báo là hoàn toàn đúng. Có hai ràng buộc mà tôi không muốn - những thứ mà iOS tự thêm vào.
2015-09-29 11:24:57.771 app[1039:324736] Unable to simultaneously satisfy constraints.
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)
(
"<NSLayoutConstraint:0x147d3e0d0 UIView:0x14901ff70.height == 0.5625*UIView:0x14901ff70.width>",
"<NSLayoutConstraint:0x147dd0210 H:|-(0)-[UIView:0x14901ff70] (Names: '|':UITableViewCellContentView:0x14901f960)>",
"<NSLayoutConstraint:0x147deeca0 V:|-(0)-[UIView:0x14901ff70] (Names: '|':UITableViewCellContentView:0x14901f960)>",
"<NSLayoutConstraint:0x149053c30 V:[UIView:0x14901ff70]-(0)-| (Names: '|':UITableViewCellContentView:0x14901f960)>",
"<NSLayoutConstraint:0x147dbc2b0 H:[UIView:0x14901ff70]-(0)-| (Names: '|':UITableViewCellContentView:0x14901f960)>",
"<NSLayoutConstraint:0x149070800 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x14901f960(179.5)]>",
"<NSLayoutConstraint:0x1490707b0 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x14901f960(320)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x147d3e0d0 UIView:0x14901ff70.height == 0.5625*UIView:0x14901ff70.width>
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.
Điều duy nhất tôi thấy ở đây là thiếu 0,5 pixel mà iOS đã loại trừ bằng cách nào đó kỳ diệu.
Điều duy nhất tôi thấy ở đây là thiếu 0,5 pixel mà iOS trừ đi bằng cách nào đó kỳ diệu? Thông tin này ở đâu? – BangOperator
@somexyz đọc các ràng buộc đã đăng nhập: 'V: [UITableViewCellContentView: 0x14da0ff60 (179.5)]' –