Reputation: 3475
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
.
Upvotes: 2
Views: 684
Reputation: 26345
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.
Upvotes: 1