我似乎在以编程方式为我正在使用的 UITableView 设置约束时遇到了一些问题。我的尝试如下,并且尝试了所有translatesAutoresizingMaskIntoConstraints
可能的组合。
self.view.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-100-[_tableView]-20-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_tableView)]];
我只是想在 UIViewController 上的 UITableView 的开头和底部添加一个空格。有人可以帮忙吗?
长长的错误如下。
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)
(
"<NSAutoresizingMaskLayoutConstraint:0x75c8500 h=-&- v=-&- UITableView:0x799e400.midY == UIView:0x71a4ec0.midY>",
"<NSLayoutConstraint:0x71a5800 V:[UITableView:0x799e400]-(20)-| (Names: '|':UIView:0x71a4ec0 )>",
"<NSLayoutConstraint:0x71a5a60 V:|-(100)-[UITableView:0x799e400] (Names: '|':UIView:0x71a4ec0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x71a5800 V:[UITableView:0x799e400]-(20)-| (Names: '|':UIView:0x71a4ec0 )>
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.
2013-04-04 20:06:57.648 New eCard[29731:c07] 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)
(
"<NSAutoresizingMaskLayoutConstraint:0x75c8540 h=-&- v=-&- UITableView:0x799e400.height == UIView:0x71a4ec0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x75c8500 h=-&- v=-&- UITableView:0x799e400.midY == UIView:0x71a4ec0.midY>",
"<NSLayoutConstraint:0x71a5a60 V:|-(100)-[UITableView:0x799e400] (Names: '|':UIView:0x71a4ec0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x71a5a60 V:|-(100)-[UITableView:0x799e400] (Names: '|':UIView:0x71a4ec0 )>
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.
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)
(
"<NSAutoresizingMaskLayoutConstraint:0x75c8540 h=-&- v=-&- UITableView:0x799e400.height == UIView:0x71a4ec0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x75c8500 h=-&- v=-&- UITableView:0x799e400.midY == UIView:0x71a4ec0.midY>",
"<NSLayoutConstraint:0x71a5800 V:[UITableView:0x799e400]-(20)-| (Names: '|':UIView:0x71a4ec0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x71a5800 V:[UITableView:0x799e400]-(20)-| (Names: '|':UIView:0x71a4ec0 )>
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.