nsviewcontroller

Add completion handler to presentViewControllerAsSheet(NSViewController)?

孤者浪人 提交于 2019-12-02 02:35:48
I am attempting to present a sheet configuration view ( AddSoundEffect ) for my main window/view controller (I'm using storyboards), and when the configuration view controller is dismissed, take the values entered in the AddSoundEffect view and pass that back to the main view. My current code in the main view controller: presentViewControllerAsSheet(self.storyboard!.instantiateControllerWithIdentifier("AddSoundEffect") as! AddSoundViewController And in the AddSoundViewController.swift file, the code to dismiss it is: self.dismissViewController(self) To pass the data, I have a class-independent

QuickLook consumer as a delegate from an NSViewController

£可爱£侵袭症+ 提交于 2019-12-01 03:21:08
I am having some problems implementing QuickLook functionality from a table in an NSView . The limited documentation on QuickLook really doesn't help at all. After reading through the Apple Docs (which are geared heavily towards custom generators and plugins), I ended up looking at the QuickLookDownloader sample code . This code is based upon a document-based application, but appears to be the right method for me (after all it is Apple's code and it does work in their project). In my implementation I can get the QuickLook panel to show up just fine, and I can dismiss it just as easy. However,

QuickLook consumer as a delegate from an NSViewController

别说谁变了你拦得住时间么 提交于 2019-11-30 23:31:04
问题 I am having some problems implementing QuickLook functionality from a table in an NSView . The limited documentation on QuickLook really doesn't help at all. After reading through the Apple Docs (which are geared heavily towards custom generators and plugins), I ended up looking at the QuickLookDownloader sample code. This code is based upon a document-based application, but appears to be the right method for me (after all it is Apple's code and it does work in their project). In my

How to use NSViewController in an NSDocument-based Cocoa app

╄→гoц情女王★ 提交于 2019-11-30 12:19:52
问题 I've got plenty of experience with iOS, but Cocoa has me a bit confused. I read through several Apple docs on Cocoa but there are still details that I could not find anywhere. It seems the documentation was written before the NSDocument-based Xcode template was updated to use NSViewController, so I am not clear on how exactly I should organize my application. The template creates a storyboard with an NSWindow, NSViewController. My understanding is that I should probably subclass

How to use NSViewController in an NSDocument-based Cocoa app

故事扮演 提交于 2019-11-30 02:29:06
I've got plenty of experience with iOS, but Cocoa has me a bit confused. I read through several Apple docs on Cocoa but there are still details that I could not find anywhere. It seems the documentation was written before the NSDocument-based Xcode template was updated to use NSViewController, so I am not clear on how exactly I should organize my application. The template creates a storyboard with an NSWindow, NSViewController. My understanding is that I should probably subclass NSWindowController or NSWindow to have a reference to my model object, and set that in makeWindowControllers(). But

Backward compatibility of Xcode OSX

喜欢而已 提交于 2019-11-29 11:47:28
How to use features such as viewDidLoad or appDidBecomeActive in Xcode 4.6.1 for OSX 10.8, which are available only for OSX 10.10 and above. Please suggest the alternative ways to use these functions. To expand on Ken Thomas's comment; this is the code that I use: - (void)loadView { [super loadView]; // if we're running on 10.8 or older… if (NSAppKitVersionNumber <= NSAppKitVersionNumber10_8) { [self viewDidLoad]; // call viewDidLoad (added in 10.9) } } // // This will be called by loadView pre-10.9; directly otherwise // - (void)viewDidLoad { // --- YOUR CODE HERE --- } // viewDidLoad I'd

Mac OS X Cocoa multiview application navigation

若如初见. 提交于 2019-11-29 01:14:50
问题 I've already spent 2 full days trying to figure out how to use NSViewControllers in order to create a multiview application. Here is what I do. I have 2 View Controllers and the MainMenu.xib's Window. I also have an AppController that is the delegate for both View Controllers. When I launch the app, I'm first greeted with the MainMenu.xib's Window's view which holds a button. On clicking this button, an IBAction is sent to the appController and asks for the SecondViewController to display it

Backward compatibility of Xcode OSX

本秂侑毒 提交于 2019-11-28 05:35:03
问题 How to use features such as viewDidLoad or appDidBecomeActive in Xcode 4.6.1 for OSX 10.8, which are available only for OSX 10.10 and above. Please suggest the alternative ways to use these functions. 回答1: To expand on Ken Thomas's comment; this is the code that I use: - (void)loadView { [super loadView]; // if we're running on 10.8 or older… if (NSAppKitVersionNumber <= NSAppKitVersionNumber10_8) { [self viewDidLoad]; // call viewDidLoad (added in 10.9) } } // // This will be called by

NSViewController and multiple subviews from a Nib

删除回忆录丶 提交于 2019-11-28 03:02:36
I'm having a difficult time wrapping my head around loading views with Interface Builder and NSViewController. My goal is to have a view which meets the following description: Top bar at the top (like a toolbar but not exactly) which spans the entire width of the view, and a second "content view" below. This composite view is owned by my NSViewController subclass. It made sense to use Interface Builder for this. I have created a view nib, and added to it two subviews, laid them out properly (with the top bar and the content view). I've set File's Owner to be MyViewController , and connected

How to add NSViewController to a responder chain?

让人想犯罪 __ 提交于 2019-11-27 21:31:18
I'm having hard time understanding and finding info about how to make NSViewController accept key and mouse events. I read somewhere that in order to register these events in NSViewController it should be added to a responder chain, but I can't find the answer how to properly do this. Any kind of help is highly appreciated! There's a nice tutorial found at CocoaWithLove.com . Summed up: you'll create a subclass of NSView (e.g. "EugeneView") and then that subclass will have some extra methods in it, such as " setNextResponder " and " setViewController ". And doing these two methods should get