加载自定义Cell

  • (UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @”Cell”;

    CustomCell cell = (CustomCell )[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
    cell = [[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier];

    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@”CustomCell” owner:self options:nil];

    for (id obj in nib) {
    if ([obj isKindOfClass:[CustomCell class]]) {
    cell = (CustomCell *) obj;
    }
    }

    }
    return cell;
    }