Why won't my awakeFromNib fire?

前端 未结 3 1244
慢半拍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:10

    Based on what you've told us, I believe I know what your problem is. awakeFromNib is called when an object is deserialized from a nib file. Here you have an object, which is the owner, that exists before the nib is loaded. Thus awakeFromNib would never be sent to your AlignmentViewController.h.

    If you need to do something here, try using loadView instead. Or just do it after loading the nib. What is it that you're tying to do that you wanted to do it in awakeFromNib?

提交回复
热议问题