I posted some source code (JLNAutoSizingTokenField) in response to a StackOverflow question. It’s another NSTokenField subclass that auto-sizes itself after editing and provides a method to flag it for autosizing.

The purpose of its -setNeedsSizeToFit: method is to get around the OP’s problem of the token sizes being different than the string sizes set with -setObjectValue:. Though the OP is using a different class (for vertical resizing), this approach can be easily adapted to the vertically-resizing class he mentions.

Download the source here.

Related Posts