开发者

NSLevelIndicator with text on It?

How can I add text开发者_运维百科 on top of a NSLevelIndicator? [the NSLevelIndicator is in my statusbar, if that matters]


The best way to add text to your NSLevelIndicator user interface is by adding a separate Label NSTextField. The NSLevelIndicator control does not have a title or other text associated with it.

From within Interface Builder, just grab a Label and drag it to your window above or beside the NSLevelIndicator.


Contrary to the correct answer to your previous question, if you want to use an NSLevelIndicator as a background and draw text on top of it, you're better off creating a custom view that owns and uses an NSLevelIndicatorCell for the background drawing.

You might also consider drawing the background yourself; e.g., fill with your choice of green/yellow/red, and then draw a white gradient on top of it. This is more appropriate if you're not really indicating a level with your level indicator.

Also, don't forget to test your application with Sim Daltonism, to make sure that the text is still readable to color-blind users.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜