loadDataRepresentation:ofType:
Loads the document data.
Declaration
- (BOOL) loadDataRepresentation:(NSData *) data ofType:(NSString *) type;Discussion
Overridden by subclasses to load document data (docData) of type docType into the receiver, display it in windows, and return whether the operation was successful. This method is typically invoked by loadFileWrapperRepresentation:ofType: after an NSData object is created from the contents of the file wrapper (which can include directories). The default implementation raises an NSInternalInconsistencyException. Subclasses must override this method unless they override readFromFile:ofType: or loadFileWrapperRepresentation:ofType: to do specialized reading and loading of document data.
The docType argument is the type name corresponding to the value of the CFBundleTypeName entry in the document type’s Info.plist dictionary.
Here is an example implementation:
//Document type name
NSString *MyDocumentType = @"Rich Text Format (RTF) document";
...
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType {
NSAssert([aType isEqualToString: MyDocumentType], @"Unknown type");
fileContents = [data copyWithZone:[self zone]];
return YES;
}See Also
Methods
dataRepresentationOfType:fileAttributesToWriteToFile:ofType:saveOperation:fileNamefileWrapperRepresentationOfType:initWithContentsOfFile:ofType:initWithContentsOfURL:ofType:loadFileWrapperRepresentation:ofType:printShowingPrintPanel:readFromFile:ofType:readFromURL:ofType:revertToSavedFromFile:ofType:revertToSavedFromURL:ofType:runModalPageLayoutWithPrintInfo:saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:saveToURL:ofType:forSaveOperation:error: