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 mainBundleloadNibNamed:@"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 allocinitWithImage:[UIImage imageNamed:@"list"]] autorelease];

    cell.backgroundView = backgroundView;

    UIImageView *accessoryView = [[[UIImageView allocinitWithImage:[UIImage imageNamed:@"ad1"]] autorelease];

    [accessoryView setFrame:CGRectMake(0.0f0.0fCATEGORY_CELL_AC_WIDTHCATEGORY_CELL_AC_HEIGHT)];

    cell.accessoryView = accessoryView;

    

    return cell;

}

posted on 2012-08-02 15:32  刚冲出起跑线的人  阅读(1798)  评论(0编辑  收藏  举报

导航