Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]

    在看精通IOS开发一书的UITableView时候遇到这个问题,

    UITableView *tableView = (id)[self.view viewWithTag:1];
    tableView.rowHeight = 65;
    UINib *nib = [UINib nibWithNibName:@"NameAndColorCell" bundle:nil];
    [tableView registerNib:nib forCellReuseIdentifier:CellTableIdentifier];

    打了个断点发现tableview是nil,看了半天都不知道是什么原因,后来发现是tag的问题,默认拖进来的UITableView是0,而书上的例子是1。

posted on 2015-12-14 17:16  Vicky_Liu  阅读(223)  评论(0)    收藏  举报

导航