Reputation: 8320
I set background color to table view. Color has 30% transparency. Issue is that part of the table where there is no cell, color is displayed with transparency set. But cell is displayed with no transparency.
I don't set color in code. Table background color is set in storyboard. Please ask for any other information required.
Table in storyboard :
Code :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
MyCell *cell = (MyCell *) [self.tableView dequeueReusableCellWithIdentifier:CELL_IDENTIFIER forIndexPath:indexPath];
// Set cell content
cell.NameLabel.text = ...;
cell.SequenceLabel.text = ...;
cell.NumberLabel.text = ...;
cell.backgroundColor = tableView.backgroundColor; // Also tried setting to [UIColor clearColor]
return cell;
}
Upvotes: 2
Views: 83
Reputation: 31
set the background color of the cell same as tableview background color with same transperancy, and set the tableview background color as clear color. I hope, this will be helpful.
Upvotes: 3
Reputation: 13
Hi Try using the below code & put your own RDB values :
cell.backgroundView.backgroundColor = [UIColor colorWithRed:1.0f green:2.0f blue:85.0f alpha:0.3f];
Upvotes: 2
Reputation: 508
You have to set cell's background clearcolor as well or if you are setting a background image of each cell than you have to use that transparent image and also set alpha of that image 0.3 so it will be transparent.
cell.backGroundColor=[UiColor ClearColor];
or you have to set alpha of your cell's backGround Color
cell.imageView.alpha=0.3;
Upvotes: 1
Reputation: 40030
You are setting transparency on the table view but the cells' views are not transparent. Just set the background color of each cell to transparent.
cell.backgroundColor = [UIColor clearColor];
or set it to the same color the table view is
cell.backgroundColor = self.tableView.backgroundColor;
Upvotes: 1