简体   繁体   English

如何在OS X Yosemite中开发状态栏应用程序?

[英]How to develop status bar app in OS X Yosemite?

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 (eg .title , .highlightMode , and .image ) are deprecated in OS X 10.10. 我一直在尝试为Yosemite开发状态栏应用程序,这是我的第一个OS X应用程序,但是当我搜索文档时, NSStatusItem文档说明了几乎所有的属性和方法(例如.title.highlightMode ,和.image )在OS X 10.10中已弃用。

So I wonder how I can create a status bar app for Yosemite. 所以我想知道如何为Yosemite创建状态栏应用程序。 I found those documentations from Dash, but it's weird that Apple's documentation doesn't make it deprecated yet. 我发现了来自Dash的那些文档,但Apple的文档还没有让它被弃用,这很奇怪。 But I know they are usually slow to update the documentation, though I wonder then how and where Dash got those seemingly updated information... 但我知道他们通常很难更新文档,但我想知道Dash如何以及在哪里获得那些看似更新的信息......

So which is the correct? 那么哪个是正确的? And if it is deprecated, where can I find the Yosemite-style status bar development resources? 如果它被弃用,我在哪里可以找到Yosemite风格的状态栏开发资源?

I use Xcode 6.1 Beta and Swift. 我使用Xcode 6.1 Beta和Swift。

In 10.10, NSStatusItem has a new button property which returns an instance of a new class, NSStatusBarButton inheriting from NSButton . 在10.10中, NSStatusItem有一个新的button属性,它返回一个新类的实例, NSStatusBarButton继承自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. NSStatusItem的弃用方法只是转发到按钮的相应方法。

See the header files (NSStatusItem.h and NSStatusBarButton.h) for the most current and accurate documentation. 有关最新和最准确的文档,请参阅头文件(NSStatusItem.h和NSStatusBarButton.h)。 The prerelease class references seem to be incomplete. 预发布类引用似乎不完整。 There's some brief, indirect mentions of these changes in the 10.10 AppKit release notes . 10.10 AppKit发行说明中有一些简短的,间接的提及这些变化的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM