Solution
Sorry, I guess I asked to fast.
I got it working like this:
NSPathControl subclass
- (NSSize)intrinsicContentSize {
return NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric);
}
Question
I'm having some issues with NSPathControl
and Auto Layout.
I want the path control to resize with the window. Which means, if I expand the width of the window, the NSPathControl
should expand too. This works.
Now the problem is, that if I change the URL of the path control to a longer URL, the path control expands automatically. I don't want that. I want the path control width to stay the same, except when the user resizes the window.
I tried pinning the width it, but then I can't resize the window at all...
Also, when I don't pin the window of the path control, I can't make it smaller than the actual content of the sub controls, which represent the URL.
Hope that makes sense.
How can I fix this?
Solution 2
Sorry, I guess I asked to fast.
I got it working like this:
- (NSSize)intrinsicContentSize {
return NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric);
}
OTHER TIPS
No need for subclassing. You can tell your view how much to resist compression. By default the priority is set to NSLayoutPriorityDefaultHigh
. You are probably looking for NSLayoutPriorityDragThatCannotResizeWindow
. You can set this in your XIB in the Size Inspector for the control or take a look at NSView's setContentCompressionResistancePriority:forOrientation:
.