Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional UIViews below last UILabel produce autolayout warnings #5

Closed
dformoso opened this issue Aug 19, 2014 · 4 comments
Closed

Comments

@dformoso
Copy link

Hi smileyborg, this saves a TON of time... Can't thank you enough.

Can you help me with a problem I'm having? I am running into autoLayout problems when trying to add an additional object to the sample code on iOS8. It's probably me doing something wrong.. But I just can't see it.

Creating a UIView under the bottom UILabel and giving the autoLayout constraints below will display correctly, but with lots of autoLayout warnings followed by an attempt to break constraint...

Can you help me figure out what am I doing wrong?

var square: UIView = UIView.newAutoLayoutView()

square.backgroundColor = UIColor.blackColor()
contentView.addSubview(square)

square.autoPinEdge(.Top, toEdge: .Bottom, ofView: bodyLabel, withOffset: 10.0)
square.autoPinEdgeToSuperviewEdge(.Leading, withInset: kLabelHorizontalInsets)
square.autoPinEdgeToSuperviewEdge(.Trailing, withInset: kLabelHorizontalInsets)
square.autoPinEdgeToSuperviewEdge(.Bottom, withInset: kLabelVerticalInsets)
square.autoSetDimension(ALDimension.Height, toSize: 40)

untitled

@smileyborg
Copy link
Owner

Can you share the Auto Layout exceptions being logged?

I'm pretty sure the ones you are seeing are exceptions when the cell is first created with a default height of 44 pt. Did you see this commented area in the code?

    // Note: if the constraints you add below require a larger cell size than the current size (which is likely to be the default size {320, 44}), you'll get an exception.
    // As a fix, you can temporarily increase the size of the cell's contentView so that this does not occur using code similar to the line below.
    //      See here for further discussion: https://github.com/Alex311/TableCellWithAutoLayout/commit/bde387b27e33605eeac3465475d2f2ff9775f163#commitcomment-4633188
    // contentView.bounds = CGRect(x: 0.0, y: 0.0, width: 99999.0, height: 99999.0)

@dformoso
Copy link
Author

Thanks Smileyborg,

I've posted the exceptions below. There aren't any "default size {320, 44}" exceptions, but many of the "Unable to simultaneously satisfy constraints" ones.

Other than the lines I've shown on my previous post, I've left everything as per your code in github... so to be sure it wasn't something else I did messing it up :-). It shows the exception with and without the estimatedHeightForRowAtIndexPath with a default height of 44 pt.

Interestingly... if I comment out this line...
square.autoSetDimension(ALDimension.Height, toSize: 40)
All warnings are suppressed, but of course the UIView doesn't show.

You were right when mentioning that the AutoLayout was the hardest part of getting this to work correctly.

Dan,

2014-08-20 07:26:40.849 TableViewCellWithAutoLayout[18416:560257] 17545849:_UIScreenEdgePanRecognizerEdgeSettings.edgeRegionSize=13.000000
2014-08-20 07:26:40.878 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecb9c736a0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecb9c8d550(44)]>",
"<NSLayoutConstraint:0x7fecb9c973a0 V:|-(10)-[UILabel:0x7fecb9c8beb0'Marion'] (Names: '|':UITableViewCellContentView:0x7fecb9c8d550 )>",
"<NSLayoutConstraint:0x7fecb9c97940 V:[UILabel:0x7fecb9c8beb0'Marion']-(>=10)-[UILabel:0x7fecb9c8c410' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecb9c81f90 V:[UILabel:0x7fecb9c8c410' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecb9c8c7c0]>",
"<NSLayoutConstraint:0x7fecb9c97bb0 UIView:0x7fecb9c8c7c0.bottom == UITableViewCellContentView:0x7fecb9c8d550.bottom - 10>",
"<NSLayoutConstraint:0x7fecb9c98cc0 V:[UIView:0x7fecb9c8c7c0(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecb9c98cc0 V:[UIView:0x7fecb9c8c7c0(40)]>

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-08-20 07:26:40.882 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecb9d446d0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecb9d43570(44)]>",
"<NSLayoutConstraint:0x7fecb9d46470 V:|-(10)-[UILabel:0x7fecb9d42d50'Copperplate'] (Names: '|':UITableViewCellContentView:0x7fecb9d43570 )>",
"<NSLayoutConstraint:0x7fecb9d46810 V:[UILabel:0x7fecb9d42d50'Copperplate']-(>=10)-[UILabel:0x7fecb9d43080' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecb9d46cb0 V:[UILabel:0x7fecb9d43080' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecb9d43400]>",
"<NSLayoutConstraint:0x7fecb9d46a80 UIView:0x7fecb9d43400.bottom == UITableViewCellContentView:0x7fecb9d43570.bottom - 10>",
"<NSLayoutConstraint:0x7fecb9d47cf0 V:[UIView:0x7fecb9d43400(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecb9d47cf0 V:[UIView:0x7fecb9d43400(40)]>

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-08-20 07:26:40.884 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecbbc8d4e0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecbbc7fb00(44)]>",
"<NSLayoutConstraint:0x7fecbbc8eda0 V:|-(10)-[UILabel:0x7fecbbc8c840'Heiti SC'] (Names: '|':UITableViewCellContentView:0x7fecbbc7fb00 )>",
"<NSLayoutConstraint:0x7fecbbc8f140 V:[UILabel:0x7fecbbc8c840'Heiti SC']-(>=10)-[UILabel:0x7fecbbc57840' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecbbc8f5f0 V:[UILabel:0x7fecbbc57840' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecbbc523a0]>",
"<NSLayoutConstraint:0x7fecbbc8ec10 UIView:0x7fecbbc523a0.bottom == UITableViewCellContentView:0x7fecbbc7fb00.bottom - 10>",
"<NSLayoutConstraint:0x7fecbbc909a0 V:[UIView:0x7fecbbc523a0(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecbbc909a0 V:[UIView:0x7fecbbc523a0(40)]>

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-08-20 07:26:40.887 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecbb917540 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecbb9167a0(44)]>",
"<NSLayoutConstraint:0x7fecbb919110 V:|-(10)-[UILabel:0x7fecbb915f80'Iowan Old Style'] (Names: '|':UITableViewCellContentView:0x7fecbb9167a0 )>",
"<NSLayoutConstraint:0x7fecbb919990 V:[UILabel:0x7fecbb915f80'Iowan Old Style']-(>=10)-[UILabel:0x7fecbb9162b0' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecbb918460 V:[UILabel:0x7fecbb9162b0' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecbb916630]>",
"<NSLayoutConstraint:0x7fecbb918d70 UIView:0x7fecbb916630.bottom == UITableViewCellContentView:0x7fecbb9167a0.bottom - 10>",
"<NSLayoutConstraint:0x7fecbb91abf0 V:[UIView:0x7fecbb916630(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecbb91abf0 V:[UIView:0x7fecbb916630(40)]>

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-08-20 07:26:40.889 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecbb91e490 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecbb91d730(44)]>",
"<NSLayoutConstraint:0x7fecbb91fc00 V:|-(10)-[UILabel:0x7fecbb91cf00'Courier New'] (Names: '|':UITableViewCellContentView:0x7fecbb91d730 )>",
"<NSLayoutConstraint:0x7fecbb920440 V:[UILabel:0x7fecbb91cf00'Courier New']-(>=10)-[UILabel:0x7fecbb91d230' Lorem ipsum dolor!!!']>",
"<NSLayoutConstraint:0x7fecbb9201a0 V:[UILabel:0x7fecbb91d230' Lorem ipsum dolor!!!']-(10)-[UIView:0x7fecbb91d630]>",
"<NSLayoutConstraint:0x7fecbb91fac0 UIView:0x7fecbb91d630.bottom == UITableViewCellContentView:0x7fecbb91d730.bottom - 10>",
"<NSLayoutConstraint:0x7fecbb921200 V:[UIView:0x7fecbb91d630(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecbb921200 V:[UIView:0x7fecbb91d630(40)]>

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-08-20 07:26:40.891 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecb9c9bb20 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecb9c9adc0(44)]>",
"<NSLayoutConstraint:0x7fecb9c9d530 V:|-(10)-[UILabel:0x7fecb9c9a5a0'Apple SD Gothic Neo'] (Names: '|':UITableViewCellContentView:0x7fecb9c9adc0 )>",
"<NSLayoutConstraint:0x7fecb9c9dca0 V:[UILabel:0x7fecb9c9a5a0'Apple SD Gothic Neo']-(>=10)-[UILabel:0x7fecb9c9a8d0' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecb9c9caa0 V:[UILabel:0x7fecb9c9a8d0' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecb9c9ac50]>",
"<NSLayoutConstraint:0x7fecb9c9d390 UIView:0x7fecb9c9ac50.bottom == UITableViewCellContentView:0x7fecb9c9adc0.bottom - 10>",
"<NSLayoutConstraint:0x7fecb9c9c180 V:[UIView:0x7fecb9c9ac50(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecb9c9c180 V:[UIView:0x7fecb9c9ac50(40)]>

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-08-20 07:26:40.893 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecb9d4ae50 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecb9d49ed0(44)]>",
"<NSLayoutConstraint:0x7fecb9d4c490 V:|-(10)-[UILabel:0x7fecb9d496b0'Heiti TC'] (Names: '|':UITableViewCellContentView:0x7fecb9d49ed0 )>",
"<NSLayoutConstraint:0x7fecb9d4c830 V:[UILabel:0x7fecb9d496b0'Heiti TC']-(>=10)-[UILabel:0x7fecb9d499e0' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecb9d4bd90 V:[UILabel:0x7fecb9d499e0' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecb9d49d60]>",
"<NSLayoutConstraint:0x7fecb9d4caa0 UIView:0x7fecb9d49d60.bottom == UITableViewCellContentView:0x7fecb9d49ed0.bottom - 10>",
"<NSLayoutConstraint:0x7fecb9d4dc60 V:[UIView:0x7fecb9d49d60(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecb9d4dc60 V:[UIView:0x7fecb9d49d60(40)]>

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-08-20 07:26:40.896 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecb9ca2660 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecb9ca1900(44)]>",
"<NSLayoutConstraint:0x7fecb9ca4050 V:|-(10)-[UILabel:0x7fecb9ca10c0'Gill Sans'] (Names: '|':UITableViewCellContentView:0x7fecb9ca1900 )>",
"<NSLayoutConstraint:0x7fecb9ca43f0 V:[UILabel:0x7fecb9ca10c0'Gill Sans']-(>=10)-[UILabel:0x7fecb9ca1410' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecb9ca3950 V:[UILabel:0x7fecb9ca1410' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecb9ca1790]>",
"<NSLayoutConstraint:0x7fecb9ca4660 UIView:0x7fecb9ca1790.bottom == UITableViewCellContentView:0x7fecb9ca1900.bottom - 10>",
"<NSLayoutConstraint:0x7fecb9ca2cb0 V:[UIView:0x7fecb9ca1790(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecb9ca2cb0 V:[UIView:0x7fecb9ca1790(40)]>

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-08-20 07:26:40.898 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecb9d512c0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecb9d50550(44)]>",
"<NSLayoutConstraint:0x7fecb9d52cc0 V:|-(10)-[UILabel:0x7fecb9d4fd30'Marker Felt'] (Names: '|':UITableViewCellContentView:0x7fecb9d50550 )>",
"<NSLayoutConstraint:0x7fecb9d53060 V:[UILabel:0x7fecb9d4fd30'Marker Felt']-(>=10)-[UILabel:0x7fecb9d50060' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecb9d53500 V:[UILabel:0x7fecb9d50060' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecb9d503e0]>",
"<NSLayoutConstraint:0x7fecb9d532d0 UIView:0x7fecb9d503e0.bottom == UITableViewCellContentView:0x7fecb9d50550.bottom - 10>",
"<NSLayoutConstraint:0x7fecb9d51910 V:[UIView:0x7fecb9d503e0(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecb9d51910 V:[UIView:0x7fecb9d503e0(40)]>

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-08-20 07:26:40.901 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecbb803e80 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecbb803120(44)]>",
"<NSLayoutConstraint:0x7fecbb805520 V:|-(10)-[UILabel:0x7fecbb802900'Thonburi'] (Names: '|':UITableViewCellContentView:0x7fecbb803120 )>",
"<NSLayoutConstraint:0x7fecbb8059a0 V:[UILabel:0x7fecbb802900'Thonburi']-(>=10)-[UILabel:0x7fecbb802c30' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecbb805d70 V:[UILabel:0x7fecbb802c30' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecbb802fb0]>",
"<NSLayoutConstraint:0x7fecbb805350 UIView:0x7fecbb802fb0.bottom == UITableViewCellContentView:0x7fecbb803120.bottom - 10>",
"<NSLayoutConstraint:0x7fecbb804550 V:[UIView:0x7fecbb802fb0(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecbb804550 V:[UIView:0x7fecbb802fb0(40)]>

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-08-20 07:26:40.904 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecb9ca93b0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecb9ca8650(44)]>",
"<NSLayoutConstraint:0x7fecb9caadb0 V:|-(10)-[UILabel:0x7fecb9ca7b20'Avenir Next Condensed'] (Names: '|':UITableViewCellContentView:0x7fecb9ca8650 )>",
"<NSLayoutConstraint:0x7fecb9cab520 V:[UILabel:0x7fecb9ca7b20'Avenir Next Condensed']-(>=10)-[UILabel:0x7fecb9ca7e50' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecb9caa190 V:[UILabel:0x7fecb9ca7e50' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecb9ca8500]>",
"<NSLayoutConstraint:0x7fecb9caac40 UIView:0x7fecb9ca8500.bottom == UITableViewCellContentView:0x7fecb9ca8650.bottom - 10>",
"<NSLayoutConstraint:0x7fecb9cac960 V:[UIView:0x7fecb9ca8500(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecb9cac960 V:[UIView:0x7fecb9ca8500(40)]>

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-08-20 07:26:40.938 TableViewCellWithAutoLayout[18416:560257] 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:0x7fecb9cafb90 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fecb9caee20(44)]>",
"<NSLayoutConstraint:0x7fecb9cb1590 V:|-(10)-[UILabel:0x7fecb9cae640'Tamil Sangam MN'] (Names: '|':UITableViewCellContentView:0x7fecb9caee20 )>",
"<NSLayoutConstraint:0x7fecb9cb1d00 V:[UILabel:0x7fecb9cae640'Tamil Sangam MN']-(>=10)-[UILabel:0x7fecb9cae930' Lorem ipsum dolor sit am...']>",
"<NSLayoutConstraint:0x7fecb9cb0b00 V:[UILabel:0x7fecb9cae930' Lorem ipsum dolor sit am...']-(10)-[UIView:0x7fecb9caecb0]>",
"<NSLayoutConstraint:0x7fecb9cb13f0 UIView:0x7fecb9caecb0.bottom == UITableViewCellContentView:0x7fecb9caee20.bottom - 10>",
"<NSLayoutConstraint:0x7fecb9cb2b80 V:[UIView:0x7fecb9caecb0(40)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fecb9cb2b80 V:[UIView:0x7fecb9caecb0(40)]>

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.

@smileyborg
Copy link
Owner

@dformoso The pasted exception console output looks like it's missing all the useful info:

 (
 "",
 "",
 "=10)-[UILabel:0x7fecb9cae930' Lorem ipsum dolor sit am...']>",
 "",
 "",
 ""
 )

The output above should show the details (description) for each constraint - instead it's just showing empty quotes. Can you please check that you copy-pasted these correctly?

In any case, this is the type of console output you will get if your cell requires a height larger than the default height of 44 pt. Basically, if you add up all the vertical padding amounts as well as the heights of any views with Required priority, and these exceed the height of the cell/contentView at any point in time, you're going to see these exceptions. This is because the table view cell height isn't calculated and set to the appropriate size until after doing one layout pass, and during this first layout pass the cell is at its default size (44 pt) which may not be tall enough to fit everything without breaking a Required-priority constraint. Therefore, you will get these exceptions.

Did you try uncommenting the one line of code suggested to see if that resolves the exceptions?

contentView.bounds = CGRect(x: 0.0, y: 0.0, width: 99999.0, height: 99999.0)

@dformoso
Copy link
Author

That last line fixed it.

Again, many thanks for your help.!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants