Wednesday, 14 December 2011

Custom Cell Code-iPhone

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

static NSString *cellID= @"catogoryCell";
    CustomCatogory *cell = (CustomCatogory *)[tableView dequeueReusableCellWithIdentifier:cellID];
   
    if(cell==nil)
    {
       
       
        NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCatogory" owner:nil options:nil];
       
        for(id currentObject in nibObjects)
        {
            if([currentObject isKindOfClass: [CustomCatogory class]])
            {
                cell = (CustomCatogory *)currentObject;
            }
           
        }
    }
    cell.img1.image=[UIImage imageNamed:@"Tweet1.jpg"];
    cell.title1.text = [categoryList objectAtIndex:indexPath.section] ;
   
   
   
    return cell;
}

1 comment: