开发者

Create informational popup / tooltip in Cocoa

开发者 https://www.devze.com 2023-03-07 06:02 出处:网络
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 t开发者_开发百科hings. Anyone can tell me what

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

Create informational popup / tooltip in Cocoa

I am trying to create one of those yellow informational popup t开发者_开发百科hings. Anyone can tell me what they're called and how I can create them?


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


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];
0

精彩评论

暂无评论...
验证码 换一张
取 消