@implementation NVController
//Plain Init method
-(id)init
{
self=[super init];
if(self)
{
}
return self;
}
//CustomInit Method
-(id)initWithRootViewController:(UIViewController *)rootViewController
{
self=[super initWithRootViewController:rootViewController];
if(self)`enter code here`
{
}
return self;
}
@end
NVController *instance=[[NVController alloc] initWithRootViewController:nil];
這裏在上面的情況下,因爲我只打電話initWithRootViwController
,另一個構造函數init
也被調用。任何幫助,將不勝感激。爲什麼默認構造函數和自定義構造函數是爲UINavigaionController的子類調用的?
如果您的問題得到解答,請接受其中一個答案。 – 2012-08-16 08:47:11