Thursday, 5 July 2012

Adding BG Image to the cells

UIImage*    backgroundImage = nil;
    UIImageView* backgroundView    = [[UIImageView alloc] initWithFrame:cell.frame];
    if (indexPath.row == 0)
    {
        backgroundImage = [UIImage imageNamed:@"top_cell.png"];
       
    }
    else if (indexPath.row ==[xmlElementObjects count]-1)
    {
        backgroundImage    =[UIImage imageNamed:@"bottom_cell.png"];
    }
    else
    {
        backgroundImage    =[UIImage imageNamed:@"middle_cell.png"];
       
    }
    backgroundView.image = backgroundImage;
    [cell setBackgroundView:backgroundView];
   
    if (backgroundView)
    {
        [backgroundView release];
        backgroundView = nil;
    }

No comments:

Post a Comment