Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create informational popup / tooltip in Cocoa

The question title is kind of vague, but I really don't know what the thing is called.

I am trying to create one of those yellow informational popup things. Anyone can tell me what they're called and how I can create them?

like image 807
fresskoma Avatar asked May 21 '11 14:05

fresskoma


2 Answers

That's called a tool tip. You can set the tool tip for any NSView using setToolTip:.

like image 89
edc1591 Avatar answered Nov 14 '22 22:11

edc1591


If you are using NSTextView, you can even set an attribute for a certain range in NSTextstorage, that displays the Tooltip. Something like:

[textStorage addAttribute:NSToolTipAttributeName
                    value:error.description
                    range:range];
like image 31
heiko Avatar answered Nov 14 '22 21:11

heiko