nsdocument

Where do you put cleanup code for NSDocument sub-classes?

雨燕双飞 提交于 2019-11-30 20:07:25
I have a document-based application and I have sub-classed NSDocument and provided the required methods, but my document needs some extensive clean-up (needs to run external tasks etc). Where is the best place to put this? I have tried a few different methods such as: close close: canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo dealloc If I put it in dealloc , sometimes it gets called and other times it does not (pressing Command+Q seems to bypass my document's deallocation), but it is mandatory that this code gets called without failure (unless program unexpectedly terminates).

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

Where do you put cleanup code for NSDocument sub-classes?

断了今生、忘了曾经 提交于 2019-11-30 04:12:32
问题 I have a document-based application and I have sub-classed NSDocument and provided the required methods, but my document needs some extensive clean-up (needs to run external tasks etc). Where is the best place to put this? I have tried a few different methods such as: close close: canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo dealloc If I put it in dealloc , sometimes it gets called and other times it does not (pressing Command+Q seems to bypass my document's deallocation), but

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

Multiple Documents in a Single Window in Cocoa

女生的网名这么多〃 提交于 2019-11-28 07:03:49
I want to write an application which may have multiple documents in a single window via a tabbed interface. Should I avoid the NSDocument architecture (the Cocoa Document-based Application template)? As far as I can tell, it supports only one or more window per document but not vice versa. I have been wrestling with this question for a while and have already built much of my application on the NSDocument architecture but I cannot figure out a good way to associate multiple documents with a single window. EDIT: I want to have project document windows in addition to basic document windows. At

How to inspect the responder chain?

♀尐吖头ヾ 提交于 2019-11-28 06:25:01
I'm doing some crazy multiple documents inside a single window stuff with the document-based architecture and I'm 95% done. I have this two-tier document architecture, where a parent document opens and configures the window, providing a list of "child" documents. When the user selects one of the children, that document is opened with the same window controller and it places a NSTextView in the window. The window controller's document association is changed so that the "edited dot" and the window title track the currently selected document. Think of an Xcode project and what happens when you

iCloud enabled - Stop the open file displaying on application launch?

让人想犯罪 __ 提交于 2019-11-27 14:56:56
问题 I've just added iCloud support to an app that I am working on. Its working great, except that when I open the application without a document in focus the iCloud open file dialog appears and I don't want it to! In my app delegate I have: - (BOOL) applicationShouldOpenUntitledFile:(NSApplication *)sender { [mainWindowController.window makeKeyAndOrderFront:self]; return NO; } Which I use to show my own custom window. However now, both the iCloud open file dialog and my own dialog are displayed.

How to save created PDF in document folder and merge in iOS

*爱你&永不变心* 提交于 2019-11-27 14:33:37
Updated I am able to create single PDF page of photo captured with comment in iPHone. On button click I am generating one single PDF page every time and I want those PDF page in single PDF bunch. I am not able to merge the single PDF files in to bunch. http://mobile.tutsplus.com/tutorials/iphone/generating-pdf-documents/?search_index=3 I have followed the above URL code. Could you suggest some logic here. Thanks in advance. * Edit in code * can you check below code. - (IBAction)didClickOpenPDF { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);

Multiple Documents in a Single Window in Cocoa

耗尽温柔 提交于 2019-11-27 01:25:26
问题 I want to write an application which may have multiple documents in a single window via a tabbed interface. Should I avoid the NSDocument architecture (the Cocoa Document-based Application template)? As far as I can tell, it supports only one or more window per document but not vice versa. I have been wrestling with this question for a while and have already built much of my application on the NSDocument architecture but I cannot figure out a good way to associate multiple documents with a

How to inspect the responder chain?

半城伤御伤魂 提交于 2019-11-27 01:07:09
问题 I'm doing some crazy multiple documents inside a single window stuff with the document-based architecture and I'm 95% done. I have this two-tier document architecture, where a parent document opens and configures the window, providing a list of "child" documents. When the user selects one of the children, that document is opened with the same window controller and it places a NSTextView in the window. The window controller's document association is changed so that the "edited dot" and the