-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier=@"Cell";
MagazineListCell* cell=(MagazineListCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell==nil)
{
NSArray *arr=[[NSBundle mainBundle]loadNibNamed:@"MagazineListCell" owner:nil options:nil];
cell=(MagazineListCell *)[arr objectAtIndex:0];
[cell setDelegate:self];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
}
NSMutableArray *arr=[[NSMutableArray alloc]init];
NSInteger startIndex;
NSInteger endIndex;
if(isLandscape)
{
startIndex=indexPath.row*3;
if (startIndex+3>[self.arrMagazine count ])
{
endIndex=[self.arrMagazine count];
}
else
{
endIndex=startIndex+3;
}
}
else
{
startIndex=indexPath.row*2;
if (startIndex+2>[self.arrMagazine count])
{
endIndex=[self.arrMagazine count];
}
else
{
endIndex=startIndex+2;
}
}
for (int x=startIndex; x<endIndex; x++)
{
[arr addObject:[self.arrMagazine objectAtIndex:x]];
}
[cell setSelectedIndex:btnSegment.selectedSegmentIndex];
[cell contentForTableViewCell:arr setUIMode:isLandscape] ;
arr=nil;
return cell;
}
问问题
85 次