我在我的故事板中遇到了一个问题。它运行得很好,但当我尝试更改UITableView的content属性时,会导致以下错误:
-[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]中的断言失败:/ SourceCache / UIKit / UIKit-2903.23 / UITableView.m 由于未捕获异常“NSInternalInconsistencyException”而终止应用程序,原因是:“无法使用标识符Cell取消队列化单元格 - 必须为标识符注册一个nib或类,或连接一个故事板中的样型单元格。”
我想设计一个带有静态单元格的分组表视图。提前感谢。
代码
-[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]中的断言失败:/ SourceCache / UIKit / UIKit-2903.23 / UITableView.m 由于未捕获异常“NSInternalInconsistencyException”而终止应用程序,原因是:“无法使用标识符Cell取消队列化单元格 - 必须为标识符注册一个nib或类,或连接一个故事板中的样型单元格。”
我想设计一个带有静态单元格的分组表视图。提前感谢。
代码
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
return cell;
}