cocoabits / MASShortcut

Modern framework for managing global keyboard shortcuts compatible with Mac App Store. More details:
http://blog.shpakovski.com/2012/07/global-keyboard-shortcuts-in-cocoa.html
BSD 2-Clause "Simplified" License
1.52k stars 220 forks source link

MASShortcut & MASPreferences #7

Closed sebj closed 12 years ago

sebj commented 12 years ago

Loving MASShortcut, but I seem to be struggling to use it and MASPreferences together. Is there any chance of a demo project that also uses MASPreferences somewhere? Thanks.

shpakovski commented 12 years ago

@sebj Have you looked into the MASPreferences Demo? Just insert MASShortcutView into the view controller and then perform setup in -[awakeFromNib]. Some day I would make a common Demo project :)

sebj commented 12 years ago

Thanks

I'm doing all the MASShortcutView setup code in -[awakeFromNib], in my view controller. If I try and use the shortcut, it won't work unless the user has first opened the preferences window (MASPreferences), as awakeFromNib won't have been called otherwise.

shpakovski commented 12 years ago

Hi @sebj, -[awakeFromNib] should be used only for configuring the shortcut view. To setup the global shortcut monitor please consider -[applicationDidFinishLaunching:]. Does it help?