Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Howiieque

macrumors regular
Original poster
Feb 1, 2009
120
0
awakefromnib: is listed in an informal protocol. apple document says that if implement an informal, i should declare again both in the interface section and the implementation section. But it seems that people just implement it in their implementation section, why?
 

Howiieque

macrumors regular
Original poster
Feb 1, 2009
120
0
it seems that every object from the nib file gets a awakefromnib message after being load. if i don't implement the awakefromnib method, why no error occur? it has no awakefromnib at all.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
awakefromnib: is listed in an informal protocol. apple document says that if implement an informal, i should declare again both in the interface section and the implementation section. But it seems that people just implement it in their implementation section, why?
Redeclaring it is unneeded because it's already declared in NSNibAwaking.h so the compiler already knows about it. If you're explicitly calling [myObject awakeFromNib] from another class you may want to declare it, but I don't know a situation where this would be needed.

it seems that every object from the nib file gets a awakefromnib message after being load. if i don't implement the awakefromnib method, why no error occur? it has no awakefromnib at all.
The nib loading class is probably calling [yourObject respondsToSelector:mad:selector(awakeFromNib)] before to prevent errors.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.