I am implementing an iChat-like app, using NSTextView to display chat records. The problem is how to change the width of NSTextView automatically based on characters in it. For example, the width of NSTextView is only one character width if there’s only one character in it. More than 100 characters will automatically increase the height of NSTextView.
I am implementing an iChat-like app, using NSTextView to display chat records. The problem
Share
You can use the string addition
[-NSString boundingRectWithSize:options:attributes:]to get a bounding rectangle. You might also want to look into the Layout Manager.