伊谢尔伦2017-04-18 09:25:36
Idea 1: As on the first floor, using UICollectionView, you can place 2 Cells in one row
Idea 2: Continue to use UITableView and put two Views in one cell
PHP中文网2017-04-18 09:25:36
- (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;
}