自定义cell空解决

staticNSString *CustomCellIdentifier =@"CellIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CustomCellIdentifier];
    if (cell ==nil) {
        NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"Cell" owner:self options:nil];
        //        if ([nib count] > 0) {
        //            cell = self.tableViewCell;
        //        } else {
        //            NSLog(@"failed to load CustomCell nib file!");
        //        }
        cell = [nib objectAtIndex:0]; // 注释掉的和该句是两种方式,在这里两种方式都行。但是如果没有上面红色处(图XXX)的拖拽连接过程,这里只能使用nib objectAtIndex方式。
    }

猜你喜欢

转载自peng13123.iteye.com/blog/1987413