Let's say you have your basic View xib file, the file owner is a ViewController which you have class files for, and there is a View which has class files as well. You set a view outlet on the File Owner to the UIView using Interface Builder.
This is all loaded via another ViewController whose xib name is set to that View xib file.
Everything just loads automatically, there's no question about that. When you create a UIViewController class file, it gives you a built-in function called initWithNibName. I would assume this gets called in place of things like loadView or viewDidLoad.
I set a break point, but this is never getting called.
My problem is I'm trying to mimic the Accelerometer Graph example, but it's not working right when I load it on my phone. So I'm trying to bypass the accelerometer calls (since the simulator doesn't fire the events), and just draw my graph. I tried putting the draw method in initWithNibName, but like I said, it's not getting called.
Any object instance that is loaded from a nib will get created using initWithCoder: because the nib contains serialized object, and when the nib is loaded, the instances is reconstituted from the object archive, meaning that instead of init:, initWithFrame:, initWithNibName:, or initWithLarryMoeAndCurley:, it will always use initWithCoder: to initialize the object.
Try putting your code in initWithCoder:, make sure to call super first, and return self.