Theo tệp tiêu đề UIView.h, các phương pháp bên dưới sẽ không được chấp nhận.Thay thế cho phương thức tự động trả lời của UIView không được dùng nữa
Cách thay thế để làm việc với tính năng tự động hoàn thành trong mã là gì?
Tôi không thấy các phương pháp được đề xuất trong nhận xét mã thay thế các đối tác hiện tại của chúng như thế nào khi chúng hoạt động trên ràng buộc thực tế chứ không phải về mối quan hệ giữa UIView và ràng buộc.
@interface UIView (UIConstraintBasedLayoutInstallingConstraints)
- (NSArray *)constraints NS_AVAILABLE_IOS(6_0);
- (void)addConstraint:(NSLayoutConstraint *)constraint NS_AVAILABLE_IOS(6_0); // This method will be deprecated in a future release and should be avoided. Instead, set NSLayoutConstraint's active property to YES.
- (void)addConstraints:(NSArray *)constraints NS_AVAILABLE_IOS(6_0); // This method will be deprecated in a future release and should be avoided. Instead use +[NSLayoutConstraint activateConstraints:].
- (void)removeConstraint:(NSLayoutConstraint *)constraint NS_AVAILABLE_IOS(6_0); // This method will be deprecated in a future release and should be avoided. Instead set NSLayoutConstraint's active property to NO.
- (void)removeConstraints:(NSArray *)constraints NS_AVAILABLE_IOS(6_0); // This method will be deprecated in a future release and should be avoided. Instead use +[NSLayoutConstraint deactivateConstraints:].
@end
Ý của bạn là "thêm nó vào chế độ xem chính xác cho bạn"? Ý nghĩa dựa trên thuộc tính 'first/secondItem'? –
"Chế độ xem chính xác" phụ thuộc vào vị trí của hai chế độ xem trong cấu trúc phân cấp chế độ xem. Nếu view B là một subview của view A, nó sẽ thêm các ràng buộc để xem A. Nếu view A và B là cả subviews của view khác, nó thêm ràng buộc vào superview của view A và B. – vacawama
Thú vị - để tham khảo, ở đây là một lần viết ngắn: http://ericasadun.com/2014/07/11/beta-auto-layout-constraint-activation/ –