2014-04-22 6 views
0

자동 레이아웃 iOS7 응용 프로그램에 문제가 있습니다. 스크롤러와 UINavigationController가 있습니다. 3.5 인치 장치에서 실행하면 UINavigationController" 훔치기 "공간이 생기고 내 레이아웃의 맨 아래가 장치 아래쪽에 렌더링됩니다. 그것은 탐색 모음의 높이에 의해 자르지 않습니다, 나는 그것을 표시하거나 숨길 수 있으며 문제가 남아 있습니다.Autolayout with UIScroller 3.5 "장치에서 작동하지 않습니다

다음은 4.0 "버전 :

enter image description here

그리고 여기 깨진 3.5"의 다음

enter image description here

내 뷰의 구조 :

enter image description here

가장 바깥 쪽보기에는 https://github.com/michaeltyson/TPKeyboardAvoiding에서 사용할 수있는 편리한 UIScrollView 하위 클래스 인 TPKeyboardAvoidingScrollView가 포함되어있어 키보드 표시 및 숨기기를 쉽게 관리 할 수 ​​있습니다. 내부 UIView는 TPKeyboardAvoidingScrollView가 스크롤 할 서브 뷰입니다. 그리고 내부에는 UITableView와 높이가 고정 된 UIView가 있으며 일부 UI 위젯이 포함되어 있으며 창 아래쪽에 붙어 있어야합니다.

구속 조건은 상당히 간단하게 설정되며 각 외부보기는 선행, 후행, 상단 및 하단 가장자리에 고정됩니다. UITableView 및 "회색"보기가 아닙니다. 회색보기는 고정 된 높이 194를 가지고 있으며 상수가 0 인 바닥에 고정되어 있습니다. 물론 UITableView는 고정 된 높이를 가지고 있지 않지만 194의 상수로 바닥에 고정되어 있습니다. 또한 맨 앞과 맨 위 및 맨 위에 고정되어 있습니다. 아, 저는 또한 편집기> AutoLayout 문제 해결> 누락 된 제약 조건 추가를 수행했습니다.

self.automaticallyAdjustsScrollViewInsets = NO; 
    _scrollView.translatesAutoresizingMaskIntoConstraints = NO; 
    _scrollerSubView.translatesAutoresizingMaskIntoConstraints = YES; 

나는 또한 jQuery과를 채우고 보통 재사용 세포 코딩을 수행

내가있는 viewDidLoad에서 내가 할, 내 UIViewController에 내부의 일반적인 트릭을한다.

필자는 AutoLayout 제약 조건을 가지고 놀았지만 올바른 것으로 보이는 것 외에도 아무 것도하지 않는 것 같습니다. 그리고 물론 나는 콘솔에서 "제약 조건을 동시에 만족시킬 수 없다"라는 오류를 가지고 있지만 솔직히 말해서 나에게 도움이되지 않습니다.

2014-04-22 17:31:34.856 Sample[3695:60b] 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:0xa35cc60 UIView:0x8f446e0.centerY == TPKeyboardAvoidingScrollView:0x8f44070.centerY>", 
    "<NSLayoutConstraint:0xa35d3b0 V:|-(0)-[TPKeyboardAvoidingScrollView:0x8f44070] (Names: '|':UIView:0xa35d270)>", 
    "<NSLayoutConstraint:0xa35d440 V:[TPKeyboardAvoidingScrollView:0x8f44070]-(0)-| (Names: '|':UIView:0xa35d270)>", 
    "<NSAutoresizingMaskLayoutConstraint:0xa364a00 h=--& v=--& UIView:0x8f446e0.midY == + 284>", 
    "<NSAutoresizingMaskLayoutConstraint:0xa365120 h=-&- v=-&- UIView:0xa35d270.height == UIViewControllerWrapperView:0xa35c550.height>", 
    "<NSAutoresizingMaskLayoutConstraint:0xa365880 h=-&- v=-&- UIViewControllerWrapperView:0xa35c550.height == UINavigationTransitionView:0x8f3a7a0.height>", 
    "<NSAutoresizingMaskLayoutConstraint:0xa366140 h=-&- v=-&- UINavigationTransitionView:0x8f3a7a0.height == UILayoutContainerView:0x8f353a0.height>", 
    "<NSAutoresizingMaskLayoutConstraint:0xa366710 h=-&- v=-&- UILayoutContainerView:0x8f353a0.height == UIWindow:0xa12ff50.height>", 
    "<NSAutoresizingMaskLayoutConstraint:0xa367100 h=--- v=--- V:[UIWindow:0xa12ff50(480)]>" 
) 

Will attempt to recover by breaking constraint 

지금 진행 방법이 약간 손실됩니다. 이것은 복잡한 상황이 아니지만 그것은 나를 당황하게했습니다. 나는 수많은 질문을 읽었으며 모든 것을 시도했지만 분명히 그렇게하지 못했다고 생각한다.

이 간단한 UI를 3.5 인치 및 4 인치 iOS7 장치에서 모두 사용하려면 어떻게해야합니까?

답변

0

알 수 있습니다.

위의 3 줄을 viewDidLoad에서 viewDidAppear로 이동하면 완벽하게 작동합니다.

난 그냥이 작품의 이유를 명확히하기 위해

My UIScrollView doesn't work with auto-layout in ios6에 이것을 Chandan 대답에 렘브란트 Q. 아인슈타인의 코멘트에서이를 생각 : 자동 레이아웃이있는 viewDidLoad 후에 만 ​​ViewDidAppear 전에 발생 -layoutSubviews에 마법을 작동 - 렘브란트를 큐.아인슈타인

관련 문제