我在我的故事板中添加了一个表视图控制器,并在我的项目中添加了一个表视图控制器类,但是当我自定义该类时,Interface Builder无法识别我的视图控制器类。我使用Xcode 6.1.1和swift。
我选择表视图控制器并输入" ChecklistViewController"进入"自定义课程"手动,但在运行时,我收到一条消息说"界面生成器文件中的未知类ChecklistViewController。"
这是我的故事视图控制器类:
import UIKit
class ChecklistViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 0
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 0
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("ChecklistItem") as UITableViewCell
return cell
}
}