gpt4 book ai didi

ios - 数据未出现在 TableView 中

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:22:27 25 4
gpt4 key购买 nike

我想做的是解析 XML 并让元素填充 TableView 。 XML 可以很好地解析并在控制台中打印,但无法在 TableView 中显示。这是我填充单元格的代码:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if(cell == nil){
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"];
NSMutableDictionary *news = (NSMutableDictionary *)[feeds objectAtIndex:indexPath.row];
[cell.textLabel setText:[news objectForKey:@"title"]];
[cell.detailTextLabel setText:[news objectForKey:@"link"]];
[cell.detailTextLabel setNumberOfLines:2];
}
return cell;
}

最佳答案

我得到它来显示。好像我忘了在 viewDidLoad 方法中设置数据源...谢谢大家的帮助。

关于ios - 数据未出现在 TableView 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20298311/

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