nsdocument

How to access NSDocument object from another object held in NSMutableArray?

女生的网名这么多〃 提交于 2019-12-11 16:25:32
问题 This is really an extension of How to show calculated values in NSTableView? The problem : I have an NSDocument class that contains two properties: text (NSString) and phrases (NSMutableArray of NSObjects with NSString in them). In the Doc NIB file I have a TextView (to display phrases) with two columns. First column is bound to an ArrayController and displays NSString. That works ok. I want to count the number of NSString occurrences in text and display that in the second column. What I

Bringing UIManagedDocument to OS X?

萝らか妹 提交于 2019-12-11 08:17:12
问题 I'll need to implement asynchronous saving in a Core Data document-based application. My NSDocument subclass is patterned just like iOS' UIManagedDocument with a pair of NSManagedObjectContext instances, one for the main thread with a parent context for background saving. The problem is that whenever I the document, the app always displays a prompt: The document ... could not be saved. The file has been changed by another application. I wonder what is missing from my implementation? How can I

Reverse engineering NSDocument file

被刻印的时光 ゝ 提交于 2019-12-11 05:53:32
问题 I have an unsupported file format from an OS X program. It uses NSDocument , unfortunately the vendor won't help with the format - or allow export. So what are the first steps in reverse engineering this format based on NSDocument ? The program still uses deprecated initWithContentsOfFile methods from os x 10.3. I have access to the program, my data and lots of sample data. I've done some initial work on disassembly of the program, and revese engineering the format. But haven't made much

Should I use an NSViewController for this?

血红的双手。 提交于 2019-12-11 03:24:56
问题 I want my application to have a single document but several screens without resorting to several windows. What's the best way to achieve this? I'm thinking of using a single NSPersistentDocument that will start with a NSViewController displaying a set of controls and then swap that view for another NSViewController. My question is: is this the correct use of NSViewControllers? Can it even be done? And if the answer to both is yes, how do I swap a view for another in a document? 回答1: Yes, it's

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

霸气de小男生 提交于 2019-12-10 12:09:02
问题 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 my app I have the disclosure indictor, but get no menu which I click it. Do I need to add this menu via code? If so, i'm assuming I need to link it to the window somehow, but I don't see a proper place to do so. Any suggestions on what i'm

How do you bind a storyboard view to a Core Data entity when using NSDocument?

穿精又带淫゛_ 提交于 2019-12-09 06:59:38
问题 I'm building an OS X app that uses core data, NSDocument, storyboards, and Cocoa bindings. My expectation is that the following occurs: An instance of MyDocument ( NSDocument subclass) is created. MyDocument creates a Core Data NSManagedObjectContext that represents the document's data. MyDocument instantiates an NSWindowController from the storyboard by its identifier. Within the storyboard, the window controller contains DocumentEditorViewController ( NSViewController subclass) which

Multiple documents open at the same time, each with different menu item states

喜你入骨 提交于 2019-12-08 08:21:41
问题 In a Cocoa document-based application, what's the best way to keep the menu item states in the menu bar in sync with the currently visible document? For example, say you have a document with a ruler view that can be hidden/shown via "Show Rulers" (off state) and "Hide Rulers" (on state) menu items. The user has two documents open at the same time. He/she has hidden the rulers in one document, but not on the other. When the user moves between the documents the menu item should reflect the

Multiple documents open at the same time, each with different menu item states

故事扮演 提交于 2019-12-08 05:08:29
In a Cocoa document-based application, what's the best way to keep the menu item states in the menu bar in sync with the currently visible document? For example, say you have a document with a ruler view that can be hidden/shown via "Show Rulers" (off state) and "Hide Rulers" (on state) menu items. The user has two documents open at the same time. He/she has hidden the rulers in one document, but not on the other. When the user moves between the documents the menu item should reflect the state for that document, not for the application as a whole. How does one do this cleanly? I've googled

display all videos stored in document directory

ぐ巨炮叔叔 提交于 2019-12-08 04:22:05
问题 I stored videos in my document directory from photo library. Now i want to show all videos which are stored in my document directory.. but i don't know how its possible??? Actually i want to display all videos as like its open in photo library(four videos in a single row).. and when i click on any video... the video is start playing... can anybody help me which is the best way to show all videos from document directory to ViewController.... Thanx...... - (void) imagePickerController:

Is NSDocument and CoreData a possible combination, or is NSPersistentDocument the only way?

Deadly 提交于 2019-12-07 04:01:03
问题 I'm making an application which creates course timetables for people at my school. This is the rough design I had in mind for the application: I'd like my NSDocument subclass to represent an individual's timetable. The idea is that they open up a document, and can add courses from a pool to their timetable, then save, share, open, etc. So the timetable will be stored in an external file, chosen by the user. I'd like to use CoreData to store all the courses from which students can choose.