Monday, April 12, 2010

Starting to get the hang of it

2010-04-09 - Day 4
Things which seem odd to me right now:
IBOutlet UILabel label;

UILabel is the class, label is the name. IBOutlet feels like an attribute but it's just chilling out there all by itself with nothing special to make it stand out or assist in parsing. What does it really do? If this is valid syntax then there must be other things that can go in front of class names too, can multiple things be applied to a member at once?

New Project Files Summary

Main.m - this is where the "main" function is. It sets up the AutoRelease pool and loads the main window. To figure out which nib/xib to load it looks to the applications property list, presumably using reflection.

HelloWorld-Info.plist - this is a property list. You can set various attributes like company name here, version, icon, and Main window file

MainWindow.xib - This file is loaded in the "main" function. It contains information on things like which class to use as the app delegate, and other application details which are not general high level properties.

HelloWorldAppDelegate - This is where the main window loads. The "page_load" equivalent function is "didFinishLaunchingWithOptions", this appears to be called when your application is first opened. You can programatically load sub views here and add them to the window if you want to.

HelloWorldController (with Xib) - This is a controller/View combo. XCode links the files together so you don't have to. This is a 1-1 relationship similar to a asp Web Page, or Win Forms control where you have a view containing buttons, labels, etc, and a codebehind file where you handle touch events, do other things you need to do in response to events.

SomeOtherController (not with Xib) - you can create other controllers and other views, you are not forced to have a 1-1 relationship.

HelloWorld_Prefix.pch - this is a precompiled header file. It's created when you build and you can more or less just ignore it.

NOTE ON INTERFACE BUILDER: You will not be prompted to save files when building. Save them manually when you make a change... It will save you from scratching your head later wondering why your new events aren't firing the way you expect.

No comments:

Post a Comment