【问题标题】:'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:' XCode5'UITableView dataSource 必须从 tableView 返回一个单元格:cellForRowAtIndexPath:' XCode5
【发布时间】:2013-09-24 13:54:57
【问题描述】:

我在使用 TableView 时遇到问题,我在旧 Xcode 版本中没有,我只是在 UITableView 中创建基本单元格,但出现下一个错误。

'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'

这是.m中的代码

// numero de secciones a definir

>-(NSInteger) numberOfSectionsInTableView: (UITableView*) tableView 
{
    return 1;
}

>// numero de celdas en total

>-(NSInteger) tableView : (UITableView *) tableView numberOfRowsInSection: (NSInteger)section 
{
      return 5;
}

>// formato de las celdas, títulos, imágenes...

>-(UITableViewCell *)tableview : (UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath 
{

    static NSString *CellIdentifier = @"cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[ UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    }

>    // configure the cell...

    return cell;

}

有什么建议吗?谢了

【问题讨论】:

    标签: iphone uitableview xcode5


    【解决方案1】:

    -(UITableViewCell *)tableView : (UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath
    在 tableView 上带有大写“V”

    【讨论】:

      猜你喜欢
      • 2011-10-09
      • 2012-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多