user8135666
user8135666

Reputation:

background for uitableview cell

MyTableCell *cell=[[MyTableCell alloc]init];
cell.backgroundColor = [UIColor clearColor];

The above lines of code are still showing the white color of the cell's background and hiding the background image of the tableview.

Upvotes: 1

Views: 63

Answers (5)

Janmenjaya
Janmenjaya

Reputation: 4163

You can do it this way

cell.backgroundColor = [UIColor clearColor];
cell.backgroundView.backgroundColor = [UIColor clearColor];

Upvotes: 0

user8135666
user8135666

Reputation:

Thank you every one. I have solved the problem. I changed the background attribute in the attribute inspector in the storyboard for my cell object from default to clear color and it worked.

Upvotes: 0

Raman Srivastava
Raman Srivastava

Reputation: 396

Go to you storyboard and set the color of your uitableview cell to clear color from there.And also set uitabelview color also to clear color.

Or in you viewdidload set tableview background color to clear color and in cellforrow at indexparth delagate set

cell.contentView.backGroundColor = [UIColor ClearColor]

Upvotes: 2

Amal T S
Amal T S

Reputation: 3405

set the contentview background color also

cell.contentView.backGroundColor = [UIColor ClearColor];
cell.backGroundView.backGroundColor = [UIColor ClearColor];
cell.selectedBackGroundView.backGroundColor = [UIColor ClearColor];

Also check if you cleared the tableView.backGroundColor also

Upvotes: 0

adarshaU
adarshaU

Reputation: 960

try this

- (void)tableView:(UITableView *)tableView willDisplayCell(UITableViewCell *)cellforRowAtIndexPath:(NSIndexPath *)indexPath
{
 [cell setBackgroundColor:[UIColor clearColor]];
}

Upvotes: 0

Related Questions