RE: (newbie): how to create a 2nd document type
RE: (newbie): how to create a 2nd document type
- Subject: RE: (newbie): how to create a 2nd document type
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Thu, 27 Jan 2005 11:35:15 -0500
- Importance: Normal
I just had the same problem and posted my solution:
http://lists.apple.com/archives/cocoa-dev/2005/Jan/msg01565.html
> (1) IB: Menu:
> (a) I've added "New SubClass" (cmd-shift-N) to the File menu
> (b) associated it with the first responder
> (c) connected it to the "newDocument" action
As already noted, you want to set up a new action method, probably in your
app's main controller, that looks something like this:
-(IBAction)newSubDoc:(id)sender
{
[[NSDocumentController sharedDocumentController]
openUntitledDocumentOfType:@"Your doc type here" display:YES];
}
Then connect the menu item to that action.
>
> (2) Code:
> (a) Created a new class, sub class of an existing document.
> (b) Added -init, - (void)makeWindowControllers;
> - (NSData *)dataRepresentationOfType:(NSString *)type;
> - (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type;
> (all of which simply call [super xxxx])
There's no reason to do (b). Super is automatically used if a subclass does
not implement a method.
Jonathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden