Infinite loop when overriding initWithCoder

前端 未结 5 874
臣服心动
臣服心动 2020-12-28 08:54

I have a UIViewController with some controllers and some views. Two of these views (Grid Cell) are other nibs. I\'ve got outlets from the Grid Cells to File\'s

5条回答
  •  醉酒成梦
    2020-12-28 09:28

    loadNibNamed:: will call initWithCoder:

    Why don't you follow this pattern?

    -(id)initWithCoder:(NSCoder *)coder
    {
    
        if (self = [super initWithcoder:coder]) {
    
           // do stuff here ... 
    
        }
    
        return self;                 
    }
    

    Does [super initWithcoder:coder] do things that you want to avoid?

提交回复
热议问题