• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: (newbie): how to create a 2nd document type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >(newbie): how to create a 2nd document type (From: Mark Dawson <email@hidden>)

  • Prev by Date: Sheet animation ignoring hasShadow
  • Next by Date: looking for tableview examples
  • Previous by thread: Re: (newbie): how to create a 2nd document type
  • Next by thread: placeholder text in NSTextView
  • Index(es):
    • Date
    • Thread