SomeViewController では、カスタマイズされた init メソッドを使用したいのですが、一方で無効にし-initWithNibName:bundle:
ます:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
NSAssert(NO, @"use -initWithChannel:tag: instead");
return nil;
}
- (instancetype)initWithChannel:(NSString *)channel tag:(NSString *)tag
{
if (self = [super init]) {
self.channel = channel;
self.tag = tag;
}
return self;
}
しかし、私が を呼び出すと-initWithChannel:tag:
、-initWithNibName:bundle:
が の直後に呼び出され-[UIViewController init]
ます。なぜこれが起こったのですか?