Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift:SLKTextViewController在编辑tableview numberOfSectionsInTableView后崩溃_Ios_Objective C_Iphone_Swift_Uitableview - Fatal编程技术网

Ios Swift:SLKTextViewController在编辑tableview numberOfSectionsInTableView后崩溃

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

我使用SLKTextViewController框架安装pods,它工作正常,直到我尝试编辑numberOfRowsInSection或numberOfSectionsInTableView或cellForRowAtIndexPath的数量。为什么?

 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")