ios 用xib自定义uitableviewcell

UITableCellViewController *cell;
    static NSString *tableCellIdentifier = @"TableCellIdentifier";
    cell = (UITableCellViewController *)[tableView dequeueReusableCellWithIdentifier:tableCellIdentifier];
    if( cell == nil )
    {
       //cell = [[[UITableCellViewController alloc] initWithStyle:UITableViewCellStyleDefault
                                     //           reuseIdentifier: SimpleTableIdentifier] autorelease];
       NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"UITableCellViewController" owner:self options:nil] ;
       //cell = [nib objectAtIndex:0];
        for(id oneObject in nib){
            if([oneObject isKindOfClass:[UITableCellViewController class]]){
                cell = (UITableCellViewController *)oneObject;
            }
        }
    }
    
     cell.myText.text = @"world";

     return cell;

相关推荐