我正在尝试在UITableView
中显示一些内容。这就是我在我的故事板中做的:
在我的代码中,我创建了一个解析器,并将它传递给我的TableViewController
。然后:
- (void)parserDidEndDocument:(NSXMLParser *)parser
{
[myTVController.tableView reloadData];
}
在我的控制器中:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"RSSLinksCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
RSSObject *obj = (RSSObject *)[links objectAtIndex:indexPath.row];
cell.textLabel.text = obj.link;
return cell;
}
但我的牢房一直是空的。更奇怪的是,我也在iOS6上尝试过,它工作得很好。我试着改变细胞的backgroundColor
,它也起作用了。在日志中,我还尝试查看我的obj.link
文本是否为空或null,但结果并非如此。所以..。我真的不知道该怎么办。任何帮助都将不胜感激。
发布于 2013-11-06 03:19:28
您是否尝试过:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"RSSLinksCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"RSSLinksCell"];
}
RSSObject *obj = (RSSObject *)[links objectAtIndex:indexPath.row];
cell.textLabel.text = obj.link;
return cell;
}
https://stackoverflow.com/questions/19801221
复制