Why won't my awakeFromNib fire?

前端 未结 3 1245
慢半拍i
慢半拍i 2020-12-01 16:48

I am starting to move more of my view hierarchy construction to IB.

I have a nib file called \"AlignmentViewController.xib\" in which I set up my view hierarchy wit

3条回答
  •  爱一瞬间的悲伤
    2020-12-01 17:23

    Just adding a clarification: -awakeFromNib is sent to File's Owner in Cocoa, but not Cocoa Touch.

    From Apple's Docs:

    ...

    • It sends an awakeFromNib message to the appropriate objects in the nib file that define the matching selector:
      • In Mac OS X, this message is sent to any interface objects that define the method. It is also sent to the File’s Owner and any proxy objects that define it as well.
      • In iPhone OS, this message is sent only to the interface objects that were instantiated by the nib-loading code. It is not sent to File’s Owner, First Responder, or any other proxy objects.

提交回复
热议问题