का उपयोग कर ओएसएक्स स्टेटसबार ऐप मैं तेजी से ओएसएक्स के लिए स्टेटस बार ऐप लिखने की कोशिश कर रहा हूं। ऑब्जेक्टिव-सी में बराबर कोड काम करने लगता है और एक स्थिति पट्टी मेनू दिखाई देता है, लेकिन निम्नलिखित कोड ऐसा नहीं करता:स्विफ्ट
import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet var statusMenu: NSMenu
func applicationDidFinishLaunching(aNotification: NSNotification?) {
// Insert code here to initialize your application
}
func applicationWillTerminate(aNotification: NSNotification?) {
// Insert code here to tear down your application
}
override func awakeFromNib() {
var statusBar = NSStatusBar.systemStatusBar()
var statusBarItem = statusBar.statusItemWithLength(CGFloat(NSVariableStatusItemLength))
statusBarItem.menu = statusMenu
statusBarItem.title = "TestApp"
}
}
यदि यह काम नहीं करता है, तो यह * क्या करता है? – BergQuester
@BergQuester एप्लिकेशन चलता है और कुछ भी नहीं करता है। अगर मैं LSUIElement को अक्षम करता हूं, तो एक ट्रे/डॉक आइकन दिखाई देता है। –