What is the difference between the -awakeFromNib and -init?

2009-07-14 Thread Bright
In applications, there are - (void)awakeFromNib and - (id)init method at the same time. - (void)awakeFromNib{ //add code } - (id)init{ self = [super init]; if (self) { //add code } return self; } What's the difference between the two methods?

Re: What is the difference between the -awakeFromNib and -init?

2009-07-14 Thread Luke the Hiesterman
On Jul 14, 2009, at 2:20 AM, Bright wrote: - (void)awakeFromNib{ - (id)init{ What's the difference between the two methods? awakeFromNib is essentially a timing signifier. It gives your class a chance to do any first actions after being loaded from a nib much in the same way that

Re: What is the difference between the -awakeFromNib and -init?

2009-07-14 Thread John Baldwin
Here's some reference material that I think helps explain this. It sounds like you're new to Cocoa, so a beginning Cocoa book might be helpful as well. I liked the Hillegass book, but shop around for one that fits your style. awakeFromNib: