Ios Swift:SLKTextViewController在编辑tableview numberOfSectionsInTableView后崩溃
我使用SLKTextViewController框架安装pods,它工作正常,直到我尝试编辑numberOfRowsInSection或numberOfSectionsInTableView或cellForRowAtIndexPath的数量。为什么?Ios Swift:SLKTextViewController在编辑tableview numberOfSectionsInTableView后崩溃,ios,objective-c,iphone,swift,uitableview,Ios,Objective C,Iphone,Swift,Uitableview,我使用SLKTextViewController框架安装pods,它工作正常,直到我尝试编辑numberOfRowsInSection或numberOfSectionsInTableView或cellForRowAtIndexPath的数量。为什么? class Feed: SLKTextViewController { override class func tableViewStyleForCoder(decoder: NSCoder) -> UITableViewSt
class Feed: SLKTextViewController {
override class func tableViewStyleForCoder(decoder: NSCoder) -> UITableViewStyle {
return UITableViewStyle.Plain;
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return data.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! FeedCell
// Configure the cell...
cell.textLabel?.text = data[indexPath.row]
return cell
}
错误:
2015-08-18:04:10.593[67777:4870181]*断言
在-[UITableView]中失败
dequeueReusableCellWithIdentifier:forIndexPath:],
/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.4/UITableView.m:6540
2015-08-18:04:10.600[67777:4870181]*
应用程序由于未捕获异常“NSInternalInconsistencyException”,
原因:“无法将标识符为cell的单元格出列-必须注册”
标识符的nib或类,或连接
故事板'
***第一次抛出调用堆栈:
您既没有注册单元类,也没有注册nib文件;这是你的问题。您可以通过以下方式注册单元类:
self.tableView.registerClass(FeedCell.self, forCellReuseIdentifier: "cell")
谢谢兄弟。我研究过tableview没人提到你能推荐一个资源吗?你可以关注raywenderlich.com
self.tableView.registerClass(FeedCell.self, forCellReuseIdentifier: "cell")