问题描述
我一直在试图为Yosemite开发一个状态栏应用程序,这是我的第一个OS X应用程序,但是当我搜索该文档时, NSStatusItem
文档说几乎所有的属性和方法(例如 .title
, .highlightMode
和 .image
所以我不知道如何为Yosemite创建一个状态栏应用程序。我从Dash中找到了这些文档,但很奇怪,不会使其弃用。但我知道他们通常很慢更新文档,虽然我不知道然后怎么和Dash得到那些看起来更新的信息...
那么这是正确的?如果它被废弃,我在哪里可以找到优胜美地风格的状态栏开发资源?
我使用Xcode 6.1 Beta和Swift。
NSStatusItem 有一个新的
按钮
属性,它返回一个新类的实例, NSStatusBarButton
继承自 NSButton
。这是应该使用的,而不是在状态项上设置自定义视图。 NSStatusItem
的不赞成的方法只是转到按钮的相应方法。 请参阅头文件.h和NSStatusBarButton.h),以获取最新最准确的文档。预发布类引用似乎不完整。这些更改在。
I've been trying to develop a status bar app for Yosemite, which is my first OS X app, but when I searched for the document, the NSStatusItem
documentation says that almost all of the properties and methods there (e.g. .title
, .highlightMode
, and .image
) are deprecated in OS X 10.10.
So I wonder how I can create a status bar app for Yosemite. I found those documentations from Dash, but it's weird that Apple's documentation doesn't make it deprecated yet. But I know they are usually slow to update the documentation, though I wonder then how and where Dash got those seemingly updated information...
So which is the correct? And if it is deprecated, where can I find the Yosemite-style status bar development resources?
I use Xcode 6.1 Beta and Swift.
In 10.10, NSStatusItem
has a new button
property which returns an instance of a new class, NSStatusBarButton
inheriting from NSButton
. This is what should be used instead of setting a custom view on the status item. The deprecated methods of NSStatusItem
just forward on to the corresponding method of the button.
See the header files (NSStatusItem.h and NSStatusBarButton.h) for the most current and accurate documentation. The prerelease class references seem to be incomplete. There's some brief, indirect mentions of these changes in the 10.10 AppKit release notes.
这篇关于如何在OS X Yosemite中开发状态栏应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!