Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the equivalent "sizeWithFont: " method for the Mac?

I'm familiar with sizeWithFont: for the iPhone. Now I'm trying to build an app for the Mac and need something like that, but I don't know how to do it :/

Here's why I need it: I've got a panel that displays some text, and I want to size it so that it just fits the content (a NSTextView). How would you do it?

like image 999
Bernardo Avatar asked Feb 28 '10 01:02

Bernardo


1 Answers

Take a look at NSString's sizeWithAttributes:. You'll have to create a dictionary of attributes; take a look at Apple's documentation for that.

like image 200
andyvn22 Avatar answered Oct 04 '22 20:10

andyvn22