在表格视图单元格

时间:2016-03-05 23:03:15

标签: swift delegates segue uitableview

我在委托中有错误参考行

class AppDelegate: UIResponder, UIApplicationDelegate {

并且表视图之间的委托不存在

github link

  

2016-03-06 01:48:12.189 BusinessWallet [11069:1325173] *断言失败 - [UITableView dequeueReusableCellWithIdentifier:forIndexPath:],/ BuildRoot / Library / Cache / com.apple.xbs / Sources / UIKit_Sim / UIKit的-3512.30.14 / UITableView.m:6564   2016-03-06 01:48:12.402 BusinessWallet [11069:1325173] * 由于未捕获的异常终止应用程序' NSInternalInconsistencyException',原因:'无法使用标识符CCell对单元格进行出列 - 必须为标识符注册一个笔尖或一个类,或者在故事板中连接一个原型单元'   ***第一次抛出调用堆栈:   (       0 CoreFoundation 0x0000000107bdbe65 exceptionPreprocess + 165       1 libobjc.A.dylib 0x0000000109953deb objc_exception_throw + 48       2 CoreFoundation 0x0000000107bdbcca + [NSException raise:format:arguments:] + 106       3基金会0x00000001080244de - [NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198       4 UIKit 0x000000010853ea8d - [UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 266       5 BusinessWallet 0x0000000106f0fd61 _TFC14BusinessWallet14CategoriesView9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 113       6 BusinessWallet 0x0000000106f0fe0f _TToFC14BusinessWallet14CategoriesView9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 79       7 UIKit 0x0000000108551e43 - [UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766       8 UIKit 0x0000000108551f7b - [UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74       9 UIKit 0x0000000108526a39 - [UITableView _updateVisibleCellsNow:isRecursive:] + 2996       10 UIKit 0x000000010855b01c - [UITableView _performWithCachedTraitCollection:] + 92       11 UIKit 0x0000000108541edc - [UITableView layoutSubviews] + 224       12 UIKit 0x00000001084af4a3 - [UIView(CALayerDelegate)layoutSublayersOfLayer:] + 703       13 QuartzCore 0x000000010c06459a - [CALayer layoutSublayers] + 146       14 QuartzCore 0x000000010c058e70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366       15 QuartzCore 0x000000010c058cee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24       16 QuartzCore 0x000000010c04d475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277       17 QuartzCore 0x000000010c07ac0a _ZN2CA11Transaction6commitEv + 486       18 QuartzCore 0x000000010c07b37c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92       19 CoreFoundation 0x0000000107b07367 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23       20 CoreFoundation 0x0000000107b072d7 __CFRunLoopDoObservers + 391       21 CoreFoundation 0x0000000107afcf2b __CFRunLoopRun + 1147       22 CoreFoundation 0x0000000107afc828 CFRunLoopRunSpecific + 488       23 GraphicsServices 0x000000010b8f1ad2 GSEventRunModal + 161       24 UIKit 0x00000001083f8610 UIApplicationMain + 171       25 BusinessWallet 0x0000000106f143ed main + 109       26 libdyld.dylib 0x000000010a45c92d start + 1       27 ??? 0x0000000000000001 0x0 + 1   )   libc ++ abi.dylib:以NSException类型的未捕获异常终止   (lldb)

class CategoriesView: UITableViewController {
@IBOutlet weak var CheefsCell : UITableViewCell?
@IBOutlet weak var BeautyCell : UITableViewCell?
@IBOutlet weak var StudentServicesCell : UITableViewCell?
@IBOutlet weak var ArtAndDesigneCell : UITableViewCell?
@IBOutlet weak var StoreCell : UITableViewCell?
@IBOutlet weak var OthersCell : UITableViewCell?

   override func viewDidLoad() {
    super.viewDidLoad()
    self.clearsSelectionOnViewWillAppear = false
    }

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()}
    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 5

}
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->  UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("CCell", forIndexPath: indexPath)
    cell.accessoryType = .DisclosureIndicator
    // configure your cell here

    return cell
}
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if (segue.identifier=="CheefsSegue") {let _=segue.destinationViewController as! CheefsView}
        else  if (segue.identifier=="BeautySegue") {let _=segue.destinationViewController as! BeautyView}
        else if (segue.identifier=="StudentServiceSegue") {let _=segue.destinationViewController as! StudentServicesView}
        else  if (segue.identifier=="ArtAndDesigneSegue") {let _=segue.destinationViewController as! ArtAndDesigneView}
        else  if (segue.identifier=="StoeSegue") {let _=segue.destinationViewController as! StoreView}
        else  if (segue.identifier=="OthersSegue") {let _=segue.destinationViewController as! OthersView}

    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.
    } }

1 个答案:

答案 0 :(得分:1)

这是你的问题:

  

原因:'无法使用标识符CCell将单元格出列 - 必须   为标识符注册一个nib或类或连接原型   故事板中的单元格

在故事板中,为您的手机提供“CCell”标识符。

enter image description here