2014-09-08 2 views
0

dynamiclly 생성 된 뷰에 대한 적절한 제약 조건 설정 (이에 의해 추한 코드에 대한 유감은 테스트 용입니다) 오류 :아이폰 OS 내가 somethink 같이있어

014-09-08 13:05:20.323 CutsomViewWithText[9123:3532873] 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:0x7ba39240 UIView:0x7a758e30.bottom == UIView:0x7a76d3e0.top + 10>", 
"<NSAutoresizingMaskLayoutConstraint:0x7a74c470 h=--& v=--& UIView:0x7a758e30.midY == + 10>", 
"<NSAutoresizingMaskLayoutConstraint:0x7a75c480 h=--& v=--& V:[UIView:0x7a758e30(0)]>", 
"<NSAutoresizingMaskLayoutConstraint:0x7a76a990 h=--& v=--& UIView:0x7a76d3e0.midY == + 226.5>", 
"<NSAutoresizingMaskLayoutConstraint:0x7a76a9c0 h=--& v=--& V:[UIView:0x7a76d3e0(0)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ba39240 UIView:0x7a758e30.bottom == UIView:0x7a76d3e0.top + 10> 

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. 
2014-09-08 13:05:23.663 CutsomViewWithText[9123:3533398] Terminating since there is no system app. 

첫 번째보기와 두 번째보기간에 적절한 제약 조건을 설정하려면 어떻게해야합니까?

답변

1

y OU는 다음 코드 줄을 추가해야합니다 그렇지 않으면 당신은 검은 화면이있을 것이다,

emptyView.setTranslatesAutoresizingMaskIntoConstraints(false) 
    emptyView2.setTranslatesAutoresizingMaskIntoConstraints(false) 

var constraint = NSLayoutConstraint(item: emptyView, attribute: NSLayoutAttribute.Bottom, relatedBy: NSLayoutRelation.Equal, toItem: emptyView2, attribute: NSLayoutAttribute.Top, multiplier: 1.0, constant: 10) 

전에 적절한 프레임 emptyScrollView를 초기화하는 것을 잊지 마세요

0

보기에 추가 할 제한 조건 유형입니다.

왼쪽, 위쪽, 폭과 높이

왼쪽 구속 (샘플)

myView1.setTranslatesAutoresizingMaskIntoConstraints (FALSE)

self.addConstraint (FALSE) myView2.setTranslatesAutoresizingMaskIntoConstraints (NSLayoutConstraint (

   item:myView1, attribute:NSLayoutAttribute.Left, 

       relatedBy:NSLayoutRelation.Equal, toItem:myView2, 

       attribute:NSLayoutAttribute.Right, multiplier:1.0, constant: 0.0))