- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if ([imageArray count]/2 ==0) {
return [imageArray count]/2;
}
return [imageArray count]/2+1;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
UIImageView *imageview1;
UIImageView *imageview2;
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
imageview1 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
imageview1.tag = 100;
imageview2 = [[UIImageView alloc]initWithFrame:CGRectMake(120, 0, 100, 100)];
imageview2.tag = 101;
[cell addSubview:imageview1];
[cell addSubview:imageview2];
}else
{
imageview1 = (UIImageView *)[cell viewWithTag:100];
imageview2 = (UIImageView *)[cell viewWithTag:101];
}
if ([imageArray count]/2 ==0) {
//鍋舵暟
imageview1.image = [UIImage imageNamed:[imageArray objectAtIndex:indexPath.row*2]];
imageview2.image = [UIImage imageNamed:[imageArray objectAtIndex:indexPath.row*2+1]];
}else{
//濂囨暟
if (([imageArray count] - indexPath.row*2)==1) {
imageview1.image = [UIImage imageNamed:[imageArray objectAtIndex:indexPath.row*2]];
}else
{imageview1.image = [UIImage imageNamed:[imageArray objectAtIndex:indexPath.row*2]];
imageview2.image = [UIImage imageNamed:[imageArray objectAtIndex:indexPath.row*2+1]];}
}
return cell;