UITableView加载自定义UITableViewCell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CustomCellIdentifier = @"CustomCellIdentifier";
DiscountProductCell * cell= (DiscountProductCell*)[tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];
if (cell == nil) {
NSArray * nib = [[NSBundle mainBundle] loadNibNamed:@"DiscountProductCell" owner:self options:nil] ;
cell = [nib objectAtIndex:0];
}
PushItm * mPushItem = [mPushItems objectAtIndex:indexPath.row];
cell.item = mPushItem;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UIImageView *backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"list"]] autorelease];
cell.backgroundView = backgroundView;
UIImageView *accessoryView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ad1"]] autorelease];
[accessoryView setFrame:CGRectMake(0.0f, 0.0f, CATEGORY_CELL_AC_WIDTH, CATEGORY_CELL_AC_HEIGHT)];
cell.accessoryView = accessoryView;
return cell;
}
浙公网安备 33010602011771号