15

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?

Michael Currie
  • 13,721
  • 9
  • 42
  • 58
fresskoma
  • 25,481
  • 10
  • 85
  • 128

2 Answers2

31

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

edc1591
  • 10,146
  • 6
  • 40
  • 63
  • 6
    +1 and you can make it show up at a specific point using `addToolTipRect:owner:userData:` http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/uid/20000014-BBCHBAHJ – Dave DeLong May 21 '11 at 16:09
  • 5
    You can also use Interface Builder to assign them, in the Identity Inspector. – Dov Jun 09 '12 at 13:01
  • 1
    This Api is suits to text only. Can i show an imageView as a ToolTip. – kidsid49 May 02 '13 at 11:00
13

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];
Sangram Shivankar
  • 3,535
  • 3
  • 26
  • 38
heiko
  • 1,268
  • 1
  • 12
  • 20