我有一个包含一些UILabels和UIImageviews的自定义单元格。当我设置UIImage(reportCellViewedIndicatorOutlet)的约束时,它按预期位于单元格的右下角。
当为UILabel reportCellDateTimeOutlet设置LeftAnchor UIConstraint以定位在cellborder左边20ps的标签时,我得到一个约束冲突,我还不明白。解决这场冲突的好方法是什么?
2016-05-10 22:24:16.331 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc241e7f9b0 UIImageView:0x7fc241e9cfa0.right == homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc241e79910 UILabel:0x7fc241e9f580'23 hours ago'.left == homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e8da20 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e9f580'23 hours ago'](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e88e90 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc241e9cfa0](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e88f30 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc241e9cfa0(20)]>",
"<NSLayoutConstraint:0x7fc243769da0 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'(375)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc241e88e90 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc241e9cfa0](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>
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.
2016-05-10 22:24:16.350 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc24375c4a0 UIImageView:0x7fc24354d0d0.right == homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc2435e27a0 UILabel:0x7fc241e38520'35 minutes ago'.left == homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc2435464a0 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e38520'35 minutes ago'](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc243507050 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc24354d0d0](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc2434d4bc0 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc24354d0d0(20)]>",
"<NSLayoutConstraint:0x7fc241e84350 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'(375)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc243507050 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc24354d0d0](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>
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.
2016-05-10 22:24:16.351 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc241e257c0 UIImageView:0x7fc2437c1170.right == homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc241e01ab0 UILabel:0x7fc241e24e40'just now'.left == homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc24373e310 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e24e40'just now'](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e96a80 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc2437c1170](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e95e10 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc2437c1170(20)]>",
"<NSLayoutConstraint:0x7fc243189f30 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'(375)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc241e96a80 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc2437c1170](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>
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.
2016-05-10 22:24:16.363 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc241e7f9b0 UIImageView:0x7fc241e9cfa0.right == homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc241e79910 UILabel:0x7fc241e9f580'23 hours ago'.left == homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e90310 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e9f580'23 hours ago'](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e8fa70 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc241e9cfa0](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e8fb10 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc241e9cfa0(20)]>",
"<NSLayoutConstraint:0x7fc243769da0 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'(375)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc241e8fa70 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc241e9cfa0](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>
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.
2016-05-10 22:24:16.364 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc24375c4a0 UIImageView:0x7fc24354d0d0.right == homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc2435e27a0 UILabel:0x7fc241e38520'35 minutes ago'.left == homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc24345dd10 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e38520'35 minutes ago'](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc24343ac90 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc24354d0d0](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241ee2570 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc24354d0d0(20)]>",
"<NSLayoutConstraint:0x7fc241e84350 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'(375)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc24343ac90 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc24354d0d0](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>
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.
2016-05-10 22:24:16.366 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc241e257c0 UIImageView:0x7fc2437c1170.right == homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc241e01ab0 UILabel:0x7fc241e24e40'just now'.left == homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc243777090 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e24e40'just now'](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241ea1ab0 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc2437c1170](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc2437394d0 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc2437c1170(20)]>",
"<NSLayoutConstraint:0x7fc243189f30 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'(375)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc241ea1ab0 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc2437c1170](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>
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.
2016-05-10 22:24:16.367 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc241e257c0 UIImageView:0x7fc2437c1170.right == homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc241e01ab0 UILabel:0x7fc241e24e40'just now'.left == homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc243777090 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e24e40'just now'](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241ea1ab0 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc2437c1170](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc2437394d0 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc2437c1170(20)]>",
"<NSLayoutConstraint:0x7fc243189f30 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc24282a000'cell'(667)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc241ea1ab0 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc2437c1170](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e18880 )>
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.
2016-05-10 22:24:16.368 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc24375c4a0 UIImageView:0x7fc24354d0d0.right == homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc2435e27a0 UILabel:0x7fc241e38520'35 minutes ago'.left == homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc24345dd10 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e38520'35 minutes ago'](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc24343ac90 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc24354d0d0](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241ee2570 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc24354d0d0(20)]>",
"<NSLayoutConstraint:0x7fc241e84350 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc24299c600'cell'(667)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc24343ac90 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc24354d0d0](LTR) (Names: '|':UITableViewCellContentView:0x7fc2437901d0 )>
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.
2016-05-10 22:24:16.369 homecaremonitor[8024:1968356] 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.
(
"<NSLayoutConstraint:0x7fc241e7f9b0 UIImageView:0x7fc241e9cfa0.right == homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'.right - 3>",
"<NSLayoutConstraint:0x7fc241e79910 UILabel:0x7fc241e9f580'23 hours ago'.left == homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'.left + 20>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e90310 'IB auto generated at build time for view with fixed frame' H:|-(8)-[UILabel:0x7fc241e9f580'23 hours ago'](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e8fa70 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc241e9cfa0](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fc241e8fb10 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x7fc241e9cfa0(20)]>",
"<NSLayoutConstraint:0x7fc243769da0 'UIView-Encapsulated-Layout-Width' H:[homecaremonitor.ReportTableviewCell:0x7fc242bfda00'cell'(667)]>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7fc241e8fa70 'IB auto generated at build time for view with fixed frame' H:|-(352)-[UIImageView:0x7fc241e9cfa0](LTR) (Names: '|':UITableViewCellContentView:0x7fc241e9f9c0 )>
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.
class ReportTableviewCell : UITableViewCell {
@IBOutlet weak var reportCellSeverityOutlet: UIImageView!
@IBOutlet weak var reportCellDateTimeOutlet: UILabel!
@IBOutlet weak var reportCellDescriptionOutlet: UILabel!
@IBOutlet weak var reportCellViewedIndicatorOutlet: UIImageView!
@IBOutlet weak var reportCellCustomerLabelOutlet: UILabel!
@IBOutlet weak var reportCell: UIView!
override func awakeFromNib() {
super.awakeFromNib()
fadeDescription()
// Disable autolayout constraints
reportCell.translatesAutoresizingMaskIntoConstraints = false
// viewed Indicator constraints
let viewedIndicatorConstraints: [NSLayoutConstraint] = [
reportCellViewedIndicatorOutlet.rightAnchor.constraintEqualToAnchor(self.rightAnchor, constant: -3),
reportCellViewedIndicatorOutlet.bottomAnchor.constraintEqualToAnchor(self.bottomAnchor, constant: -3)
]
NSLayoutConstraint.activateConstraints(viewedIndicatorConstraints)
let DateTimeConstraints: [NSLayoutConstraint] = [
reportCellDateTimeOutlet.leftAnchor.constraintEqualToAnchor(self.leftAnchor, constant: 20)
]
NSLayoutConstraint.activateConstraints(DateTimeConstraints)