ViewController init? [英] ViewController init?

查看:85
本文介绍了ViewController init?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚注意到我的ViewController在启动时不调用init(见下文)。

I have just noticed that my ViewController does not call init (See below) when it starts up.

-(id)init {
    self = [super init];
    if(self) {
        NSLog(@"_init: %@", [self class]);
        otherStuff...
    }
    return self;
}

是否有原因,或者被viewDidLoad

Is there a reason for this, or is it replaced by viewDidLoad

-(void)viewDidLoad {
    otherStuff ..
    [super viewDidLoad];
}

cheers gary

cheers gary

推荐答案

它不会替换为 viewDidLoad 。这只是init不是由 initWithNibName:bundle:

It's not replaced by viewDidLoad. It's just that init's not called by initWithNibName:bundle:.

$ c> viewDidLoad 。

I just write my setup code in viewDidLoad.

这篇关于ViewController init?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆