Discussion:
Bothersome "NSView-Encapsulated-Layout-Height" constraint?
(too old to reply)
Rob Petrovec
2018-08-31 00:34:47 UTC
Permalink
You need to implement -outlineView:heightOfRowByItem: to return the height you want for each row. Hope that helps.

—Rob
Hi,
I’ve been hitting my head against a wall for more time than I’d like to admit on what should be a simple problem - maybe someone can spot it immediately…
I’m implementing a view-based source list style NSOutlineView (I’m trying to mimic the Finder sidebar). My header items are a different row height than the items underneath. I’ve implemented outlineView:rowViewForItem: (returns 24 for headers, 20 for items).
https://imgur.com/a/7KKgtZX
(
"<NSLayoutConstraint:0x60c00009be90 NSImageView:0x60c000170e00.height == 16 (active)>",
"<NSLayoutConstraint:0x60c000087ee0 V:|-(2)-[NSImageView:0x60c000170e00] (active, names: DE_DataCell:0x60c000188470, '|':DE_DataCell:0x60c000188470 )>",
"<NSLayoutConstraint:0x60c000082300 V:[NSImageView:0x60c000170e00]-(2)-| (active, names: DE_DataCell:0x60c000188470, '|':DE_DataCell:0x60c000188470 )>",
"<NSLayoutConstraint:0x60c00009c5c0 'NSView-Encapsulated-Layout-Height' DE_DataCell.height == 12 (active, names: DE_DataCell:0x60c000188470 )>"
)
This shows where the problem is: a height constraint on the row of 12 with the name "NSView-Encapsulated-Layout-Height”. This is the exact height I see being drawn. I have no idea where this is coming from or how to fix it though. Any help welcome - it’s annoying because this seems like such simple thing!
Demitri
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.na
Quincey Morris
2018-08-31 01:23:48 UTC
Permalink
(
"<NSLayoutConstraint:0x60c00009be90 NSImageView:0x60c000170e00.height == 16 (active)>",
"<NSLayoutConstraint:0x60c000087ee0 V:|-(2)-[NSImageView:0x60c000170e00] (active, names: DE_DataCell:0x60c000188470, '|':DE_DataCell:0x60c000188470 )>",
"<NSLayoutConstraint:0x60c000082300 V:[NSImageView:0x60c000170e00]-(2)-| (active, names: DE_DataCell:0x60c000188470, '|':DE_DataCell:0x60c000188470 )>",
"<NSLayoutConstraint:0x60c00009c5c0 'NSView-Encapsulated-Layout-Height' DE_DataCell.height == 12 (active, names: DE_DataCell:0x60c000188470 )>"
)
“Encapsulated layout height” sounds like one of the constraints that IB adds to your layout when it’s under-constrained at design time. Are you adding the other constraints at run time?

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This emai
David Duncan
2018-08-31 16:36:04 UTC
Permalink
Post by Quincey Morris
“Encapsulated layout height” sounds like one of the constraints that IB adds to your layout when it’s under-constrained at design time. Are you adding the other constraints at run time?
I’m not adding any constraints at run time. IB isn’t reporting anything as under-constrained. I tried to add a height constraint to the NSTableCellView, but that constraint is greyed out (and I found would have conflicted with the NSView-Encapsulated-Layout-Height anyway).
The “NSView-Encapsulated-Layout” constraints are constraints that are added to represent views that are not laying out with auto layout but still need to be represented in the solution. Beyond that, I’m not familiar with the area that you are trying to resolve. HTH.
Thanks,
Demitri
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-i
Uli Kusterer
2018-10-04 08:42:45 UTC
Permalink
(
"<NSLayoutConstraint:0x60c00009be90 NSImageView:0x60c000170e00.height == 16 (active)>",
"<NSLayoutConstraint:0x60c000087ee0 V:|-(2)-[NSImageView:0x60c000170e00] (active, names: DE_DataCell:0x60c000188470, '|':DE_DataCell:0x60c000188470 )>",
"<NSLayoutConstraint:0x60c000082300 V:[NSImageView:0x60c000170e00]-(2)-| (active, names: DE_DataCell:0x60c000188470, '|':DE_DataCell:0x60c000188470 )>",
"<NSLayoutConstraint:0x60c00009c5c0 'NSView-Encapsulated-Layout-Height' DE_DataCell.height == 12 (active, names: DE_DataCell:0x60c000188470 )>"
)
This shows where the problem is: a height constraint on the row of 12 with the name "NSView-Encapsulated-Layout-Height”. This is the exact height I see being drawn. I have no idea where this is coming from or how to fix it though. Any help welcome - it’s annoying because this seems like such simple thing!
Did you perhaps forget to set translatesAutoresizingMaskIntoConstraints = NO on one of the views you return it defaults to YES on newly-created views)? This constraint is used by the layout system to apply heights you specify elsewhere. I *think* it is one for non-AutoLayout views. If I'm misremembering, check for any other views that arrange their subviews, like NSStackViews.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.n

Continue reading on narkive:
Loading...