【发布时间】:2013-12-17 13:46:53
【问题描述】:
我试图通过这个声明来汇总 Instagram 和 Twitter 的两条时间线:
if (indexPath.row % 2 == 0)
但是,对于每条推文和图片,它只显示其他所有帖子。因为它显示了第一张和第三张 Instagram 图片,以及第二张和第四张 Twitter 推文。这是我创建每个单元格的代码:
if (indexPath.row % 2 == 0) {
static NSString *CellIdentifier = @"TweetCell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]];
NSDictionary *tweet = tweets[indexPath.row];
return cell;
}else {
static NSString *CellIdentifier = @"InstagramCell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]];
NSDictionary *entry = instaPics[indexPath.row];
return cell;
}
}
【问题讨论】:
-
我不认为“加重”意味着你认为它的意思。 :) 也许你的意思是“聚合”。
标签: ios iphone uitableview twitter nsdictionary