【发布时间】:2014-07-25 01:00:12
【问题描述】:
我决定用 Swift 继续我剩下的项目。当我将自定义类(UIViewcontroller 的子类)添加到我的故事板视图控制器并加载项目时,应用程序突然崩溃并出现以下错误:
致命错误:对类使用未实现的初始化程序“init(coder:)”
这是代码:
import UIKit
class TestViewController: UIViewController {
init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
// Custom initialization
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// #pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue?, sender: AnyObject?) {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
}
请提出建议
【问题讨论】:
标签: ios macos uiviewcontroller swift