I’m having a frustrating issue with an OSX app I am trying to write. Here is the issue:
I have a single NSTableView with a contextual menu that allows the user to show
or hide columns. Easy enough… lots of sample code out there to make that
happen. The working line is this:
// toggle the column's visibility
[tableColumns[tag] setHidden:![tableColumns[tag] isHidden]];
The problem occurs when the user hides an NSTableColumn… I start getting
errors. For example, when I hide the column with the identifier “orgCode”, I
get the following:
2015-07-02 09:57:30.560 myApp[9975:303] Unable to simultaneously satisfy
constraints:
(
"<NSLayoutConstraint:0x618000099320 'NSView-Encapsulated-Layout-Width'
H:[orgCode(0)] (Names: orgCode:0x60800018bfc0 )>",
"<NSLayoutConstraint:0x60800028cdf0 H:[NSTextField:0x60800018c160]-(2)-|
(Names: orgCode:0x60800018bfc0, '|': orgCode:0x60800018bfc0 )>",
"<NSLayoutConstraint:0x60800028cee0 H:|-(2)-[NSTextField:0x60800018c160]
(Names: orgCode:0x60800018bfc0, '|': orgCode:0x60800018bfc0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60800028cdf0 H:[NSTextField:0x60800018c160]-(2)-|
(Names: orgCode:0x60800018bfc0, '|': orgCode:0x60800018bfc0 )>
Set the NSUserDefault
NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have
-[NSWindow visualizeConstraints:] automatically called when this happens.
And/or, break on objc_exception_throw to catch this in the debugger.
My first inclination was to delete the constraints, but then the NSTextViews
within the table don’t change size with the column… that doesn’t work. Deleting
and recreating constraints whenever I hide or show a column also seems to be
way too complicated…
Any idea what I’m doing wrong?
Thanks!
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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/archive%40mail-archive.com This email sent to [email protected]
