Search code examples
xcodecocoainterface-buildernstextfield

How to let the width of an NSTextField be adjusted to its content?


I work with Xcode5.

I would like the width of my NSTextField to adapt to its content.

If possible, I would like to do this in InterfaceBuilder and if possible, without subclassing.

EDIT : I am working with autolayout ON !! (which seems to prevent me from changing the width of my NSTextField)


Solution

  • In the documentation for a NSTextField there is nothing that shows that a NSTextField can resize depending on its content, so with that I assume it's impossible. For the kicks and giggles, though, I checked the storyboard and there is no property that allows your NSTextField to be resized besides the auto resizing mask, which have nothing to do with the NSTextField text attribute.