정적 셀이있는 UITableViewController가 있습니다. 첫 번째 셀에는 uipickerView가 있습니다. (다른 셀에는 다른 것들이 있지만 관련성이 있다고는 생각하지 않습니다.) 셀의 두 가지 방법으로 pickerView를 중앙에 놓으려고했습니다. 첫째 - 나는 4 개의 제약 조건을 모두 추가했다. 그것은 저에게 오류를 주었고 시뮬레이터에서 실행할 때 올바르게 표시되지 않았습니다. 두 번째 방법은 x와 y에 2 개의 제약 조건을 추가했습니다. 그것도 나에게 오류를 줬다. 다음은 NSLayoutConstraint의 오류
오류입니다 :2015-01-18 15:47:49.533 myApp[1476:54966] 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:0x7fcbc24e9cb0 UITableViewCellContentView:0x7fcbc24da620.centerX == UIPickerView:0x7fcbc24eb1e0.centerX>",
"<NSIBPrototypingLayoutConstraint:0x7fcbc254d7e0 'IB auto generated at build time for view with fixed frame' H:|-(0)-[UIPickerView:0x7fcbc24eb1e0](LTR) (Names: '|':UITableViewCellContentView:0x7fcbc24da620)>",
"<NSIBPrototypingLayoutConstraint:0x7fcbc2556c00 'IB auto generated at build time for view with fixed frame' H:[UIPickerView:0x7fcbc24eb1e0(600)]>",
"<NSLayoutConstraint:0x7fcbc25be170 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x7fcbc24da620(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fcbc24e9cb0 UITableViewCellContentView:0x7fcbc24da620.centerX == UIPickerView:0x7fcbc24eb1e0.centerX>
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.
그것은 Y에 같은 일을했다, 그러나 더 명확 것, 그래서 나는 그것을 잘라.
나는 초급자로 말할 수 있으므로 너무 가혹하지 마십시오.
업데이트
나는 멀리 둘 제약 (x와 y)를 데리고 나는 왼쪽과 오른쪽에 제약 조건을 추가했다. 오류 메시지에 제약의 목록을 읽을 수
<NSLayoutConstraint:0x7ffcf1d76200 UITableViewCellContentView:0x7ffcf1d0a2d0.trailingMargin == UIPickerView:0x7ffcf1d78a60.trailing - 8>",
"<NSLayoutConstraint:0x7ffcf1d529b0 UIPickerView:0x7ffcf1d78a60.leading == UITableViewCellContentView:0x7ffcf1d0a2d0.leadingMargin - 8>",
"<NSIBPrototypingLayoutConstraint:0x7ffcf1c74700 'IB auto generated at build time for view with fixed frame' H:[UIPickerView:0x7ffcf1d78a60(600)]>",
"<NSLayoutConstraint:0x7ffcf1dbf220 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x7ffcf1d0a2d0(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7ffcf1d76200 UITableViewCellContentView:0x7ffcf1d0a2d0.trailingMargin == UIPickerView:0x7ffcf1d78a60.trailing - 8>
이 어느 오류, 첫 번째 또는 두 번째 방법은? – matt
두 번째 방법입니다. –
새로운 문제를 재현 할 수 없습니다. 제약 조건이 나를 위해 작동합니다. 내 다시 개정 된 답변을 참조하십시오. – matt