nsapplication

Document sheet not responding to keyboard events

吃可爱长大的小学妹 提交于 2019-12-03 10:38:41
I think it's a first responder problem, but I'm not sure. I'm implementing an edit window for data in a table view. Very similar in concept to the UI for editing filter rules in Mail.app. I have an editing window that I attach to my primary window with: [NSApp beginSheet: criteriaEditPanel modalForWindow: [self window] modalDelegate: self didEndSelector: @selector(criteriaEditDidEnd:returnCode:contextInfo:) contextInfo: (void *)[criteriaList objectAtIndex: index]]; The panel displays properly, from the title bar of the main window. I can manipulate the pop-up controls on the panel with the

How to use WebView on xcode 4.5.1

前提是你 提交于 2019-12-03 09:55:37
问题 I'm new to programming and I need to embed a website in my application (which is blank; I only want to embed the website right now). I've been searching for it since 5:00 PM (It's now 9:30 PM) and I still didn't find anything about that. What code do I need and in what file I need to write it? What do I have to link together? I use Xcode 4.5.1 and I'm trying to do a Cocoa application for Mac OS X (not for iOS). I'm sorry if some of my sentences are not clear, but English is not my primary

How to use WebView on xcode 4.5.1

被刻印的时光 ゝ 提交于 2019-12-03 00:29:23
I'm new to programming and I need to embed a website in my application (which is blank; I only want to embed the website right now). I've been searching for it since 5:00 PM (It's now 9:30 PM) and I still didn't find anything about that. What code do I need and in what file I need to write it? What do I have to link together? I use Xcode 4.5.1 and I'm trying to do a Cocoa application for Mac OS X (not for iOS). I'm sorry if some of my sentences are not clear, but English is not my primary language. If you need more information in order to help me, just ask. In your AppDelegate.h file, add this

Why can setPresentationOptions and LSUIElement not be used together?

Deadly 提交于 2019-12-02 20:29:20
问题 Code: [NSApp setPresentationOptions: NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock]; It hides Dock and MenuBar OSX. When I add key LSUIElement into my Info.plist file and rerun my code: Dock is hidden, but MenuBar doesn't hidden. Why? How to hide MenuBar after adding LSUIElement? 回答1: Well, it should hide the main menu always and forever, but using LSUIElement in the plist is an older way of doing things than using both setActivationPolicy and setPresentationOptions

Creating status item - icon shows up, menu doesn't

元气小坏坏 提交于 2019-12-02 18:07:50
问题 In a document-based project I am trying to create a status menu. I have a singleton class that builds the status bar, and I am initiating it from an application delegate, as you can see. When I run this, I get no errors, but only an image of the status bar, but no menu drops down. I created the menu in IB. What am I messing up? Delegate #import "KBAppDelegate.h" #import "KBStatusMenu.h" @implementation KBAppDelegate @synthesize window = _window; - (void)applicationDidFinishLaunching:

Creating status item - icon shows up, menu doesn't

亡梦爱人 提交于 2019-12-02 07:36:00
In a document-based project I am trying to create a status menu. I have a singleton class that builds the status bar, and I am initiating it from an application delegate, as you can see. When I run this, I get no errors, but only an image of the status bar, but no menu drops down. I created the menu in IB. What am I messing up? Delegate #import "KBAppDelegate.h" #import "KBStatusMenu.h" @implementation KBAppDelegate @synthesize window = _window; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { KBStatusMenu *aStatusItem = [[KBStatusMenu alloc] init]; aStatusItem = [

How can a Mac app determine the method used to launch it?

不羁岁月 提交于 2019-11-30 21:52:53
I have a Mac OS X application that is also a protocol handler (just as, for example, Safari is a protocol handler for the HTTP and HTTPS protocols). So when a user clicks a link of the form myscheme://some-kind-of-info in any application at all, my application launches to handle the link. Now I need to be able to determine if the application was launched by such a link click, or if it was launched by any other method. In other words, it was launched by any method besides a link click. (In those cases, I want the app to stay open, but if it was launched by a link it should quit and ignore the

How can a Mac app determine the method used to launch it?

时间秒杀一切 提交于 2019-11-30 17:50:59
问题 I have a Mac OS X application that is also a protocol handler (just as, for example, Safari is a protocol handler for the HTTP and HTTPS protocols). So when a user clicks a link of the form myscheme://some-kind-of-info in any application at all, my application launches to handle the link. Now I need to be able to determine if the application was launched by such a link click, or if it was launched by any other method. In other words, it was launched by any method besides a link click. (In

How to know if a NSWindow is fullscreen in Mac OS X Lion?

早过忘川 提交于 2019-11-30 17:31:05
I guess I should check if [NSApplication presentationOptions] contains NSFullScreenModeApplicationPresentationOptions , but how do I achieve that? EDIT: using [NSApplication presentationOptions] doesn't work as in my document-based app there might be some documents in fullscreen and others not. I'm now looking for another solution. I'm wondering why there isn't a property called [NSWindow isFullscreen] or something like that. I was just looking for a solution myself and based on Matthieu's answer I created a category on NSWindow that works fine for me. @interface NSWindow (FullScreen) - (BOOL

Subclass NSApplication in Swift

大城市里の小女人 提交于 2019-11-30 08:53:14
I created NSApplication subclass: class MyApplication: NSApplication { override func sendEvent(theEvent: NSEvent) { if theEvent.type == NSEventType.KeyUp && (theEvent.modifierFlags & .CommandKeyMask).rawValue != 0 { self.keyWindow?.sendEvent(theEvent) } else { super.sendEvent(theEvent) } } } After that, I changed "Principal class" in Info.plist to MyApplication and at the end in the Application Scene in Main.storyboard, I changed Application to MyApplication, too. When I run application I get following message: Unable to find class: MyApplication, exiting Can someone help me with this? Try: