Object-C

customCell

시크유 2010. 10. 7. 00:28

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

    

    static NSString *CellIdentifier = @"Cell";

    

    customCell *cell = (customCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

//        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

NSArray *arr = [[NSBundle mainBundleloadNibNamed:@"customCell" owner:nil options:nil];

cell = [arr objectAtIndex:0];

    }

    

// Configure the cell.

NSString *key = [self.keys objectAtIndex:[indexPath section]];

NSInteger row = [indexPath row];

cell.lblNo.text = [[NSString allocinitWithFormat:@"%d", row +1];

cell.lblText.text = [[self.items objectForKey:key] objectAtIndex:[indexPath row]];

    return cell;

}