UITableViewCell clear background - Grouped UITableView

后端 未结 6 1278
无人共我
无人共我 2021-02-10 21:45

I am trying to display my data in a grouped table as below :

\"enter

As you can

6条回答
  •  再見小時候
    2021-02-10 22:18

    Just try with it:

    Set the cell background view to YourcellImage & cells background color to clear color.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath             
    {
        static NSString *CellIdentifier = @"Cell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) 
        {
            cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    
            [cell setBackgroundColor:[UIColor clearColor]];
            UIImage *backgroundImage = nil;
            UIImageView *backgroundView = nil;
            backgroundImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"YourYellowCellImage"ofType:@"png"]];
            backgroundView = [[UIImageView alloc]initWithImage:backgroundImage];
            backgroundView.frame = CGRectMake(0, 0, 600, 80); // Over here give your cell size
            cell.backgroundColor = [UIColor clearColor];
            cell.backgroundView =backgroundView;
    
            [backgroundView release];   
       }
       //Over your set your Label Value    
       return cell;
    }
    

提交回复
热议问题