2014-03-28 3 views
0

순수 자동 레이아웃 제한을 기반으로 응용 프로그램을 만들려고합니다. 스토리 보드에 Xcode 5 파일의 "자동 레이아웃 사용"플래그를 설정합니다. 스토리 보드의 속성은 아직 예외가 있습니다. 번역을 켜지 않습니다. 코드에서 아무 곳이나 제약 조건을 지정하십시오. 자동 레이아웃이 켜져 있으면 IB가 translatesAutoresizingMaskIntoConstraints를 사용 중지합니다. 어떤 아이디어?스토리 보드에서 자동 레이아웃을 사용할 수 있지만 여전히 AutolayoutMaskContraints가 표시됩니다.

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:0xdca62c0 V:[_UILayoutGuide:0xdca7310]-(201)-[UIView:0xcc69170]>", 
    "<NSLayoutConstraint:0xdca63e0 V:[UIView:0xcc69170]-(112)-[_UILayoutGuide:0xdc51f50]>", 
    "<_UILayoutSupportConstraint:0xdc581e0 V:[_UILayoutGuide:0xdca7310(52)]>", 
    "<_UILayoutSupportConstraint:0xdc97780 V:|-(0)-[_UILayoutGuide:0xdca7310] (Names: '|':UIView:0xdca7240)>", 
    "<_UILayoutSupportConstraint:0xdc7e3b0 V:[_UILayoutGuide:0xdc51f50(32)]>", 
    "<_UILayoutSupportConstraint:0xdc7df20 _UILayoutGuide:0xdc51f50.bottom == UIView:0xdca7240.bottom>", 
    "<NSAutoresizingMaskLayoutConstraint:0xdcce0c0 h=--& v=--& V:[UIView:0xdca7240(320)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0xdca62c0 V:[_UILayoutGuide:0xdca7310]-(201)-[UIView:0xcc69170]> 

Break on objc_exception_throw to catch this in the debugger. 
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 
+1

뷰 0xdca7240이 프로그래밍 방식으로 생성 되었습니까? 프로그래밍 방식으로 생성 된 뷰의 경우'translatesAutoresizingMaskIntoConstraints'의 기본값은'YES'입니다. –

+1

** 대부분의 ** 뷰는 자동 레이아웃이 설정된 IB에서 생성 될 때'translatesAutoresizingMaskIntoConstraints'가 'NO'로 설정되지만 컨테이너보기는 그렇지 않습니다. (아니면 컨테이너 뷰가 될 임베디드 뷰입니다.) –

+0

Scott과 Timothy에게 감사드립니다. 이 일에 꽤 많은 낭비가 있었지만, 아래의 나의 대답은 내가 결정한 바입니다. – possen

답변

0

보기에 대한 루트 뷰 컨트롤러는 translatesAutoresizingMaskIntoConstraints가 항상 켜져 있습니다 것 같다. 스토리 보드 파일의 xml에서이 내용을 볼 수 있습니다. 그러나 모든 하위 뷰에는 translatesAutoresizingMaskIntoConstraints가 해제되어 있습니다. 나는 이것이 정상적인 행동이라고 생각하지만 약간의 번역이 일어나기를 기대한다면 혼란 스럽다.

관련 문제