iOS5故事板UIViewController,故事板调用哪个init方法



对于添加到情节提要的UIViewControllers,情节提要调用哪个init方法?

使用的初始值设定项是initWithCoder:

- (id)initWithCoder:(NSCoder *)decoder

然后,您还会收到一条awakeFromNib消息。

我相信是awakeFromNib

它是- (id)initWithCoder:(NSCoder *)decoder

因此,如果你必须进行自定义初始化,比如说使用自定义Pager控制器,你必须像一样在那里进行

    - (id)initWithCoder:(NSCoder *)decoder {
        self = [super initWithCoder:decoder];
        return [self initWithViewControllers:@[self.playerViewController, self.categoriesViewController]
                  andTitles:@[@"Player",@"Categories"]];
    }

最新更新