Questions tagged [nsdocument]

NSDocument is an abstract class that defines the interface for documents, objects that can internally represent data displayed in windows and that can read data from and write data to files.

NSDocument is an abstract class that defines the interface for documents, objects that can internally represent data displayed in windows and that can read data from and write data to files. Documents create and manage one or more window controllers and are in turn managed by a document controller. Documents respond to first-responder action messages to save, revert, and print their data.

Conceptually, a document is a container for a body of information identified by a name under which it is stored in a disk file. In this sense, however, the document is not the same as the file but is an object in memory that owns and manages the document data. In the context of the Application Kit, a document is an instance of a custom NSDocument subclass that knows how to represent internally, in one or more formats, persistent data that is displayed in windows.

A document can read that data from a file and write it to a file. It is also the first-responder target for many menu commands related to documents, such as Save, Revert, and Print. A document manages its window’s edited status and is set up to perform undo and redo operations. When a window is closing, the document is asked before the window delegate to approve the closing.

NSDocument is one of the triad of AppKit classes that establish an architectural basis for document-based applications (the others being NSDocumentController and NSWindowController).

References:

NSDocument Class Reference

471 questions
0
votes
1 answer

NSDocument Saving audio And Vidoes Files

I have an ios App That has Download Feature for Audio and Video Files The Question Is Where Should I Download These Files And How ?
0
votes
1 answer

NSDocument display name of page with WebKit

I'm trying to get WebKit to display the page title of the currently opened document window, which includes a WebView. The document won't display after I run the app. I'm using Document.m and windowNibName to achieve this, but I'm sure what I'm doing…
user893246
0
votes
2 answers

Cocoa - Adding menu to support versions? (Like in TextEdit)

In TextEdit, if you click the little dropdown next to the filename you get a menu which shows a couple of entries including Rename, Move to iCloud, Move To, Duplicate, Lock and finally Browse All Versions. I'm wondering how to support this menu? On…
Kyle
  • 16,103
  • 26
  • 123
  • 231
0
votes
1 answer

Link NSDocument's changeCount to NSTextView

Is there a way to somehow link an NSDocument's changeCount to the only NSTextView that is used for a document? Or so I have to implement all the necessary NSTextViewDelegate methods and update the changeCount myself?
Jawap
  • 2,131
  • 2
  • 23
  • 38
0
votes
2 answers

NSUserDefaults per document

Does the AppKit framework provide a way to store NSUserDefaults per NSDocument? If not, how would you recommend to implement this?
hpique
  • 112,774
  • 126
  • 328
  • 461
0
votes
0 answers

Load default database in CoreData document based application

I have an application based on the documents and I would like that when you create a new file the tableview are pre-populated with default data. I did the following: I launched my application and I populated the tables, then I saved the file…
Andrea
  • 427
  • 3
  • 16
0
votes
3 answers

Validate before opening a document in NSDocument architecture

I have an document based application which formats an XML file. Writing and reading of document is done in my NSDocument subclass - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError -…
Rajesh
0
votes
1 answer

NSDocument won't open

I am making my first IOS application and using JSON and core data for getting and storing my data. But for some reason or another it won't open it's NSDocument. This is what I am doing. - (void)useDocument { if (![[NSFileManager defaultManager]…
Steaphann
  • 2,745
  • 6
  • 47
  • 103
0
votes
1 answer

Open sample document from bundle

I would like my OS X app to open a sample document located in the application bundle. I'm currently doing the following: NSString* path = [[NSBundle mainBundle] pathForResource:@"tutorial.doc" ofType:nil]; [_documentController…
hpique
  • 112,774
  • 126
  • 328
  • 461
0
votes
1 answer

NSDocument app and file extension

I have created a document based app that needs to open xml text files with a particular extension. When I created the project in Xcode using the NSDocument template I specified the extension I wanted and everything was working fine. Following the…
Jacopo
  • 981
  • 1
  • 11
  • 24
0
votes
1 answer

NSDocument isLocked implementation for 10.7?

How can I check if a document isLocked in 10.7? NSDocument has a method isLocked, but it available only on 10.8.
Yoav
  • 5,605
  • 3
  • 36
  • 58
0
votes
1 answer

Why is my dataOfType: not called when saving?

I have an NSDocument that contains a dataOfType method, but it is not called when I do a save. - (NSData *)dataOfType:(NSString *)typeName error:(NSError *__autoreleasing *)outError { NSLog(@"db: %@", db); return…
Carelinkz
  • 896
  • 8
  • 26
0
votes
1 answer

Why do I get multiple instances of NSDocument but only one window?

In my Document based application, no less than three documents are opened when I run the app, yet only one window displays. When I save&quit, it saves another document than the one that belongs to the window. How can this happen? In particular, I do…
Carelinkz
  • 896
  • 8
  • 26
0
votes
1 answer

Can I create an Untitled NSDocument in readFromData?

I'm rewriting my app that reads and graphs data created by a physics simulation program. The original version reads the data files but doesn't save any type of document. I'd like to add the ability to write a document file that contains presentation…
SSteve
  • 9,937
  • 5
  • 44
  • 68
0
votes
1 answer

Make NSDocument "edited" when a binded control changes

I have an array of NSDictionaries and a NSDictionary iVar (*selectedDictionary) that points to one of the array's objects. *selectedDictionary points to a different object every time the user selects a different row in a NSTableView. Several GUI…
1 2 3
31
32