gpt4 book ai didi

ios - 无法将具有标识符 TodoItemRow 的单元格出列 - 必须为标识符注册一个 nib 或一个类,或者连接 Storyboard 中的原型(prototype)单元格

转载 作者:行者123 更新时间:2023-12-01 18:52:26 25 4
gpt4 key购买 nike

收到以下错误。

*** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法使具有标识符 TodoItemRow 的单元格出列 - 必须为标识符注册 nib 或类或连接 Storyboard 中的原型(prototype)单元格”

我有点理解为什么会发生这种情况,但有点不明白。任何帮助,将不胜感激。

#import "ViewController.h"

@interface ViewController ()

@property (nonatomic) NSMutableArray *items;

@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.items = @[@{@"name" : @"Take out the trash", @"category" : @"Home"}].mutableCopy;

self.navigationItem.title = @"What needs to be done";
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#datasource

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

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.items.count;
}

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

NSDictionary *item = self.items[indexPath.row];

cell.textLabel.text = item[@"name"];

return cell;
}

@end

最佳答案

您应该添加 标识符 这里

enter image description here

关于ios - 无法将具有标识符 TodoItemRow 的单元格出列 - 必须为标识符注册一个 nib 或一个类,或者连接 Storyboard 中的原型(prototype)单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30158336/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com