gpt4 book ai didi

objective-c - 未调用 cellForRowAtIndexPath(再次)

转载 作者:行者123 更新时间:2023-11-29 13:27:45 24 4
gpt4 key购买 nike

我已经找到了同样的问题,但答案对我没有帮助:(也许是因为我有特定的问题。将应用程序安装到 iPhone 4S(iOS 5) 后出现一些问题。我已经修复了几个,但是这个比第一眼看起来更顽固。

我在 Xcode4 中打开现有的 Xcode3 项目,出现了这个问题。

我会在这里放一些代码:

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
// Return the number of sections.
return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.

return [self.townShopsArray count];
}

我检查过:self.townShopsArray 不为空

功能:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ...

没有被调用,所以我不需要把它的代码放在这里。

谁能告诉我当我将项目从 Xcode 3 升级到 Xcode 4 时会出现什么问题?

最佳答案

以下是可能的原因:

  • 您的 UITableView 的数据源未设置为此 Controller
  • 在 Interface Builder 的 Identity Inspector 中,您的 UIViewController/UITableViewController 的类未设置为此 View Controller 的类。如果未设置,iOS 将向通用 UITableView 类询问有关您的单元格的信息,而不是您创建的类。 Custom Class

  • (如果您以编程方式添加 UITableView)...您指向表的指针不强,并且 UITableView 已被释放

关于objective-c - 未调用 cellForRowAtIndexPath(再次),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12686278/

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