我在 UIViewController 的子类中有以下内容;
- (id) initWithFullScreen
{
self = [super initWithNibName:nil bundle:nil];
if (self)
{
_fullScreen = YES;
}
return self;
}
- (id) init
{
self = [super initWithNibName:nil bundle:nil];
if (self)
{
_fullScreen = NO;
}
return self;
}
- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
return [self init];
}
如您所见,它们并没有像推荐的那样全部链接在一起,因为有两个初始化器调用指定初始化器的超类。这样做可以吗?