• 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: changing default class naming
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing default class naming


  • Subject: Re: changing default class naming
  • From: Prachi Gauriar <email@hidden>
  • Date: Thu, 20 Nov 2003 01:40:11 -0600

On Nov 20, 2003, at 12:17 AM, Aubrey wrote:

Well, when a new project is created, NSDocument is subclassed and named myDocument. I was just wondering where the name myDocument was stored. If i wanted my subclasses to be created as XYDocument, etc., is there a way to change this default setting?


Oh, okay. I'll start by saying that your NSDocument subclasses should typically be renamed on a per-application basis, e.g. for an image editor application, I'd probably have a PGImageDocument, while for a text editor, I'd probably have something like PGTextDocument or something of that nature. With that said...

I'll assume you're using Xcode. If not, the directions are similar, just the location of the project templates are somewhere else (somewhere in /Developer, I think).

Anyway, go to /Library/Application Support/Apple/Developer Tools/Project Templates/Application/Cocoa-based Application/.

You can edit this file directly, but I'd probably go ahead and back it up and work on the copy. This takes a little work.

1) Open CocoaDocApp.pbproj and rename MyDocument.h, MyDocument.m, and MyDocument.nib accordingly.

You'll probably want to change the comments at the top of MyDocument.h and MyDocument.m.

2) Open Info.plist in Property List Editor. Go to Root:CFBundleDocumentTypes:0:NSDocumentClass and change the value to the new name of your NSDocument subclass.

3) Open XYDocument.nib, click on the Classes tab, and search for MyDocument. Rename this as well.

With all that, it _should_ work. I haven't tried, but I can't think of anything else that is necessary. Hope that helps.

-Prachi
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >changing default class naming (From: Aubrey <email@hidden>)
 >Re: changing default class naming (From: Prachi Gauriar <email@hidden>)
 >Re: changing default class naming (From: Aubrey <email@hidden>)

  • Prev by Date: Re: Can one class be a dataSource for multiple NSTableViews?
  • Next by Date: Re: [OT] replace newline character with sed
  • Previous by thread: Re: changing default class naming
  • Next by thread: Re: changing default class naming
  • Index(es):
    • Date
    • Thread