指定初始化程序缺少超级调用超级类的指定初始化程序
问题描述:
我得到2个警告,像1.指定初始化程序缺少超级调用超级类的指定初始化程序。 2.指定的初始化程序只能在super上调用指定的初始化程序。指定初始化程序缺少超级调用超级类的指定初始化程序
- (instancetype)initWithFrame:(CGRect)ignoredFrame { return [self init]; }
答
尝试下面的代码,这将删除警告
- (instancetype)initWithFrame:(CGRect)ignoreframe {
self = [super initWithFrame:ignoreframe];
if (self) {
// load view frame XIB
}
return self;
}
要了解更多详细,看here