【发布时间】:2014-10-31 19:01:34
【问题描述】:
我的控制器中有这样的代码:
var itemList:[String] = []
@IBOutlet var tasksTable:UITableView!
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return itemList.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
var cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
cell.textLabel.text = itemList[indexPath.row]
return cell
}
override func viewWillAppear(animated: Bool) {
tasksTable.reloadData() <-----------------------
}
为什么会出现这个错误?
错误:在展开可选值时意外发现 nil
【问题讨论】: