Cocoa Grey Message Overlay

此生再无相见时 提交于 2019-12-07 18:23:59

问题


Various applications on Mac OS X display messages in a grey, transparent, rounded box overlay to notify the user of something; for example the "Build Succeeded" message in Xcode, the looped search message in the Lion inline-search bar and Chrome's "Warn Before Quitting" message.

An example of the message box I'm describing: http://2.bp.blogspot.com/-eG890NRhQbs/Ty0vLkqpBWI/AAAAAAAAAMs/PO2EbJ3lTs0/s1600/Xcode-11.png

As they're all very similar in formatting, it makes sense to assume there are some sort of standard functions for displaying a similar message. How can I have such an effect in my own Cocoa application?


回答1:


There isn't a public system API to do them.

You could have a look at Matt Gemmell's version: scroll down to RoundedFloatingPanel on this page.

Alternatively, if you want to Google for others, they're often known as Bezels. The private framework that draws the system ones is BezelServices.



来源:https://stackoverflow.com/questions/11969009/cocoa-grey-message-overlay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!