Re: Newbie: Storing text for use in code
Re: Newbie: Storing text for use in code
- Subject: Re: Newbie: Storing text for use in code
- From: Tom Sutcliffe <email@hidden>
- Date: Sat, 10 May 2003 15:18:07 +0100
I've searched the archives, but their system is quite annoying.
Which archives did you search? Apple's or Mamasam's?
I searched Apple's.
Personally I think Mamasam's are better as the output is formatted,
rather than plain text including email headers. Check out
<
http://cocoa.mamasam.com>.
What exactly are you going to do with these strings? If they're used
to display some text to the user, then yes, definitely use the
localized string system. Otherwise, it depends...
I'm basically writing very specialized html out to a file, and would
like to keep the type of tags I will be using in a place where I could
change them easily or add to them; somewhere other than in a header
file. I really want the equivalent of putting text in a resource file
under carbon. Maybe I could do that and open it through cocoa?
The closest to that under cocoa is to use an XML plist file in your
application's resources folder. This can be edited using the Property
List Editor (ie no need to recompile anything when you change it) and
can be read into your program using something like
NSDictionary* myOptions = [NSDictionary dictionaryWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"myOptionsFile"
ofType:@"plist"]]
( The property list editor is in /Developer/Applications, and you add
myOptionsFile.plist to your application in the Resources section, this
will copy it to the correct place in the application providing the
checkbox is ticked. )
Alternatively If you want the stuff to be editable programmatically you
should probably use the NSUserDefaults class - see the foundation API
reference for details.
Regards,
Tom
_______________________________________________
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.