【问题标题】:uitableview inside uiscrollview storyboarduiscrollview 故事板中的 uitableview
【发布时间】:2013-11-04 13:43:18
【问题描述】:

所以我在情节提要中有一个UIScrollView,在情节提要中也有一个UITableView。关键是我想在滚动视图中放入UITableView 的几个实例。但是我得到一个错误

unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

那么如何解决这个问题呢?

提前致谢!

好的!这是我的代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"DayCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    [self configerCell:cell atIndexPath:indexPath];

    return cell;
}

我在故事板中给了一个单元格一个标识符...

这就是我将 UITableView 添加到 UIScrollView 的方式:

UITableViewController *tableView = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];
[self.mainScroll addSubview:tableView.view];

【问题讨论】:

  • 您必须替换 -tableView:cellForRowAtIndexPath: 中的“Cell”,以命名您在情节提要上提供了 UITableViewCell 原型。
  • 请发布相关代码 - 可能是您的 cellForRowAtIndexPath: 方法

标签: ios iphone objective-c uitableview uiscrollview


【解决方案1】:

我认为您的表格视图单元格需要一个标识符。尝试单击表格视图单元格,然后在属性检查器下有一个名为 Identifier 的字段。检查一下!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-24
    • 2013-10-21
    • 1970-01-01
    • 1970-01-01
    • 2013-10-27
    • 1970-01-01
    • 2016-06-27
    相关资源
    最近更新 更多