segue 在 UIViewController 上调用了哪个 "init" 方法?
Which "init" method does segue call on UIViewController?
请耐心等待,当我们 link 一个 UIViewController
到另一个带有 segue 的时候,segue 使用哪个 "init" 方法来启动新的 UIViewController
?是 "initWithCoder" 吗?或者是其他东西?我需要知道,因为我需要修改 segue 用来启动 UIViewController
的 init 方法。
想法?
就是这个方法
initWithCoder
我认为这个解决方案更好
你在
中编写了一些通用代码
-(void)setUp{
//Set up
}
然后你把这段代码放在每个 initMethod:
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
if (self = [super initWithCoder:aDecoder]) {
[self setUp];
}
return self;
}
-(instancetype)init{
if (self = [super init]) {
[self setUp];
}
return self;
}
//Also other init method
请耐心等待,当我们 link 一个 UIViewController
到另一个带有 segue 的时候,segue 使用哪个 "init" 方法来启动新的 UIViewController
?是 "initWithCoder" 吗?或者是其他东西?我需要知道,因为我需要修改 segue 用来启动 UIViewController
的 init 方法。
想法?
就是这个方法
initWithCoder
我认为这个解决方案更好 你在
中编写了一些通用代码-(void)setUp{
//Set up
}
然后你把这段代码放在每个 initMethod:
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
if (self = [super initWithCoder:aDecoder]) {
[self setUp];
}
return self;
}
-(instancetype)init{
if (self = [super init]) {
[self setUp];
}
return self;
}
//Also other init method