xib自定义view crash

1.File's owner 不需要关联,只需关联根view的class

2.如果还是crash,则右击检查File's owner是否还有子view关联着它

PS:初始化方法示例:

+ (instancetype)initFromNib

{

    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"IDScreenShotView" owner:nil options:nil];

    IDScreenShotView *shotView = [nib objectAtIndex:0];

    return shotView;

}

原文地址:https://www.cnblogs.com/zhangliukou/p/7098455.html