【发布时间】: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