Re: two more hurdles for my calculator...
Re: two more hurdles for my calculator...
- Subject: Re: two more hurdles for my calculator...
- From: Graham Cox <email@hidden>
- Date: Tue, 27 May 2008 22:28:25 +1000
- Resent-cc: Cocoa-Dev List <email@hidden>
- Resent-date: Tue, 27 May 2008 22:28:53 +1000
- Resent-from: Graham Cox <email@hidden>
- Resent-message-id: <email@hidden>
On 27 May 2008, at 10:17 pm, Nathan wrote:
1. In basic I could simply use a line like: open "filename" for
input/output as #x to open a file, use input/print to save/retrieve
data, then close the file. I want to do the same thing here, as in I
simply want to save variables to a file in the simplest noobiest
way. Again, and this is getting frustrating, I'm having trouble
finding what I want in the documentation when I'm not simply looking
up an object. Can anyone help?
Plenty of easy ways to crack this nut.
NSData has a -writeToFile:atomically: method, as do a number of other
classes, like NSArray and NSDictionary. So if you put your variables
into one of those types of containers, you're done for saving data
(maybe use NSSavePanel to allow the user to set up a filename). To
read, look at class methods such as +arrayWithContentsOfFile:
2. To give my app a nice finishing touch how do I add an icon? I
seem to remember some other tutorial that was beyond me touching on
the subject and I was lost.
Convert the icon image to the .icns format (there's a tool in the
Developer utilities to do this), add it to your project as a resource,
then edit the properties of your app target (in Xcode, Project->Edit
Target "whatever", the "properties") to enter the name of the
icon.icns file (all this is doing is editing the info.plist file,
which you can also do by hand).
hth,
G.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden