about awakefromnib

Discussion in 'Mac Programming' started by Howiieque, Feb 8, 2009.

  1. Howiieque macrumors regular

    Feb 1, 2009
    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?
  2. Howiieque thread starter macrumors regular

    Feb 1, 2009
    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.
  3. kainjow Moderator emeritus


    Jun 15, 2000
    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.

    The nib loading class is probably calling [yourObject respondsToSelector:mad:selector(awakeFromNib)] before to prevent errors.
  4. Howiieque thread starter macrumors regular

    Feb 1, 2009
    thank you so much. your answer is clear and get to the point.:)

Share This Page