ios - 'UITableView' 没有可见的@interface 声明选择器 'dequeueReusableCellWithIdentifier:forIndexpath:'

标签 ios objective-c uitableview

<分区>

我是编程新手,一直在研究 Apple 的“立即开始开发 IOS 应用程序”指南。当我遇到标题中的错误时,我进入了第 3 部分教程:添加数据,它影响了代码的一部分。错误出现在以 UITableViewCell *cell

开头的行上
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"ListPrototypeCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexpath:indexPath];
    StuffItem *toDoItem = [self.toDoItems objectAtIndex:indexPath.row];
    cell.textLabel.text = toDoItem.itemName;
    return cell;
}

到目前为止,我已尽最大努力遵循指南中的所有说明,我对问题的唯一猜测可能是我命名文件的方式与建议的不同。

最佳答案

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier 
      forIndexpath:indexPath];
              ^

应该是

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier 
      forIndexPath:indexPath];
              ^

关于ios - 'UITableView' 没有可见的@interface 声明选择器 'dequeueReusableCellWithIdentifier:forIndexpath:',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24744160/

相关文章:

ios - AVAudioPlayer 在电话的音箱上播放音乐时播放音频

iphone - 如何检查用户是否在 iOS 设备上启用了 PIN 码

iphone - 如何从 NSMutable 数组中提取值并将其放入 NSArray 中?

ios - 单击 + Swift 预加载 UISearchBar 显示结果

ios - 未调用 UITableView ScrollView 委托(delegate)

iphone - 在 Webview 中加载 .xls Ms-Excel 文件显示错误

ios - UICollectionview 从库中加载照片。如何将图像传递到另一个 View Controller

iphone - 添加 SQLcipher sqlite3_exec 后返回 SQLITE_NOTADB

ios - 快速点击按钮时添加行或文本字段

swift - 我有关于 tableView 的问题。滚动时值变化