我正在構建一個狀態欄應用程序(Swift 3),並且想要根據用戶點擊左側還是右側來調用不同的操作。這是我到目前爲止: var statusItem = NSStatusBar.system().statusItem(withLength: -1)
statusItem.action = #selector(AppDelegate.doSomeAction(sender:))
let left
我想使MacOS的狀態欄,但我跑得應用標題顯示,並立即消失後 func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
let statusItem = NSStatusBar.system().
所以我有一個NSStatusBar項目的圖像的問題,它似乎像圖像推開了其餘的菜單項as you can see in this picture.但是,當菜單欄不活動(如在我爲我的其他顯示器上或者沒有在應用程序)的問題不會發生as you can see in this picture。我很確定我的代碼是正確的。 statusItem = [[NSStatusBar systemStatusBar]