Tuesday, May 22, 2007

CoreData and Objective-C

Okay,

Here was my problem. I was trying to figure out the best way to store data in Objective-C. I know that Objective-C provides many ways to write text to a file, but handling relational structures can get tricky using this method. This is when I remembered CoreData. This was a little tricky to me at first but after thinking about it in a dumb way, I was able to figure it out. I guess I was looking at it way to much in detail, making it harder than it seemed. I have created an application that uses several features of Objective-C that I just barely figured out like the Alert Panel that is relative to the window that called it as well as getting data out of the array controller when you need it.

To download the application and source, click here and your browser will begin to download it from my iDisk.

Now, if you haven't used CoreData before, I suggest the apple developers website since they have videos :-)
http://developer.apple.com/cocoa/coredatatutorial/index.html

When you have completed the video series (I think there are 14 two to three minute videos), you can then use my information to go in deeper with the CoreData stuff.

This is what I show you in my demonstration application:
  • How to access an array of information that is stored in the NSArrayController Object.

  • How to use the NSRunAlertPanel so that it drops down out of the window (The cool alert panel, I think ;-))
CoreData does all the hard work for you when it comes down to saving and loading information, but you can't do everything in the interface designer. Accessing the data in the ArrayController allows you to branch off and get even more creative with your applications without you having to manage data files.

I hope this makes someones day a little easier! It did mine... :-)

1 comment:

Anonymous said...

Hi,

I'm very interested in your code. Unfortunatelly the link is broken.

Best wishes,

Mischa