我对Swift有疑问。
我知道当我们在Objective-C中创建指定的初始值设定项时,有时我们可能需要这样做(为了加载相应的.xib文件):
if ((self = [super initWithNibName:@"PPFrameViewController" bundle:nil]))
{
}
Swift中的等价物。只是:
super.init(nibName: "PPFrameViewController", bundle: nil)
还是其他什么?
提前致谢
答案 0 :(得分:0)
对于UIViewController
,指定的初始值设定项如下:
init(nibName nibName: String?,
bundle nibBundle: NSBundle?)
因此,在初始化子类属性后,在指定的初始化程序中调用它:
// subclass properties initialized
super.init(nibName: <name>, bundle: <bundle>)
// any other initialization