开发者社区 问答 正文

关于 ios开发在表视图显示cell里的内容时出现failed to obtain a cell from its datasource??

这是代码

-(NSInteger)tableView:(UITableView )tableView numberOfRowsInSection:(NSInteger)section{
return 1; }
-(UITableViewCell)tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell cell =[tableView dequeueReusableCellWithIdentifier:@"ChecklizdvdzfbdzbstItem"]; return cell;
}

展开
收起
爵霸 2016-03-06 09:00:34 4344 分享 版权
1 条回答
写回答
取消 提交回答
  • -(UITableViewCell * ) tableView:(UITableView * ) tableView cellForRowAtIndexPath:(NSIndexPath * ) indexPath{
    static NSString * ID = @"ChecklizdvdzfbdzbstItem";
    UITableViewCell * cell =[tableView dequeueReusableCellWithIdentifier:ID];
     if (!cell) {
             UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil]
    return cell;
    }
    2019-07-17 18:53:57
    赞同 展开评论
问答分类:
问答地址: