ios 用xib自定义uitableviewcell

NineYao 2012-09-05

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;

相关推荐

囧芝麻 / 0评论 2019-12-20