无法从 plist 获取内容到 UITableview

Can't get content from plist to UITableview

你好,我收到这个错误,我找不到问题出在哪里

我的代码是这样的:

@implementation ViewController {
NSDictionary *animalDetails;
NSArray *justAnimalNames;


- (void)viewDidLoad {
    [super viewDidLoad];
    NSURL *url = [[NSBundle mainBundle] URLForResource: @"animals"withExtension:@"plist"];
    animalDetails = [NSDictionary dictionaryWithContentsOfURL:url];
    justAnimalNames = animalDetails.allKeys;

    // Do any additional setup after loading the view, typically from a nib. }
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return animalDetails.count; }
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableView *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.textLabel.text = justAnimalNames [indexPath.row];

    return cell; }

我得到的错误是在这一行:

cell.textLabel.text = justAnimalNames [indexPath.row];

属性 'textLabel' 未在 'UITableview'[=12= 类型的对象上找到]

有什么想法吗?

您的 cell 需要 UITableViewCell * 而不是 UITableView *