1. 程式人生 > >ios 自定義tableviewcell

ios 自定義tableviewcell

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath  
{  
    static NSString *CellIdentifier = @"CustomCellIdentifier";  
    MyCell *cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];  
    if (cell == nil) {  
        NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"mycell" owner:self options:nil];  
        cell = [array objectAtIndex:0];  
        [cell setSelectionStyle:UITableViewCellSelectionStyleGray];  
    }  
    [[cell lable] setText:@"31"];  
    [[cell lable1] setText:@"Raul"];  
    [[cell myImage] setImage:[UIImage imageNamed:@"3316.jpg"]];  
    return cell;  
}