我UITableView没有显示任何数据.我认为问题在于:
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell?`
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell? {
// Configure the cell...
let cellId: NSString = "Cell"
var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellId) as UITableViewCell
if let ip = indexPath {
//var data: NSManagedObject = myList[ip.row] as NSManagedObject
//cell.textLabel.text = data.valueForKey("name") as String
cell.textLabel.text = "Hi"
}
return cell
}
Run Code Online (Sandbox Code Playgroud)
我在youtube上看过使用这段代码的教程,但我无法让它工作.
首先我打了它是我的数组的一个问题,但是当我把文本放入其中它仍然没有显示任何东西.
我正在运行Xcode6 beta 3,但是这个代码确实在beta 2中运行得非常好.
我没有任何警告或错误消息.
编辑:我查找了一些其他的Swift项目,我在那里得到了相同的功能,它在2周前工作但现在它也不起作用.也许这是一个Xcode6 …