objective-cmacoscocoanspathcontrol

NSPathControl and Auto Layout


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

  • Solution

    Sorry, I guess I asked to fast.
    I got it working like this:


    NSPathControl subclass

    - (NSSize)intrinsicContentSize {
        return NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric);
    }