这个uitableview如何在每行添加两列数据,在线等
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return (List.count)/2+1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
Cell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
NSUInteger row=[indexPath row];
UIView *v1 = cell.leftView;
UIView *v2 = cell.rightView;
GoodsList *subInfo=nil;
for (NSInteger i = 0; i < 2; i++)
{
//奇数
if (row*2+i >List.count - 1)
{
v2.hidden = YES;
break;
}
subInfo = [List objectAtIndex:row*2 + i];
if (i==0)
{
v1.hidden = NO;
}else{
v2.hidden = NO;
}
2 回答1.1k 阅读
1 回答1.2k 阅读✓ 已解决
1 回答2.8k 阅读
1 回答1.4k 阅读
1.7k 阅读
1 回答949 阅读
1 回答789 阅读
思路一:如一楼,使用UICollectionView,可以一行放置2个单元Cell
思路二:继续使用UITableView,在一个单元格中放入两个View