Skip to content

Commit

Permalink
아이콘을 누르면 리본 메뉴가 나타납니다.
Browse files Browse the repository at this point in the history
  • Loading branch information
min-uuu committed Aug 7, 2020
1 parent 0053b8f commit 6e26283
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Binary file not shown.
14 changes: 14 additions & 0 deletions For_0416/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
button.image = NSImage(named:NSImage.Name("StatusBarButtonImage"))
button.action = #selector(printQuote(_:))
}

constructMenu()
}

func applicationWillTerminate(_ aNotification: Notification) {
Expand All @@ -50,5 +52,17 @@ class AppDelegate: NSObject, NSApplicationDelegate {

print("\(quoteText)\(quoteAuthor)")
}

func constructMenu() {
let menu = NSMenu()

menu.addItem(NSMenuItem(title: "Print Quote", action: #selector(AppDelegate.printQuote(_:)), keyEquivalent: "P"))
menu.addItem(NSMenuItem.separator())
menu.addItem(NSMenuItem(title: "Quit Quotes", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))

statusItem.menu = menu
}


}

1 change: 0 additions & 1 deletion For_0416/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<development version="9000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16096"/>
</dependencies>
<scenes>
Expand Down

0 comments on commit 6e26283

Please sign in to comment.