3
votes

I am using UITableView.I set the tableview background image like this.

self.tableView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]];

enter image description here

I am using table style as grouped. But in display I am getting black shadow on left and right side of grouped cell.

How to remove this black shadow?

Thanks in Advance.

5
are you set property before setting color clearclor - Srinivas
No, I did not use clearcolor property. - joe
try first clear color then set above return code - Srinivas

5 Answers

5
votes

Try this..

self.tableView.backgroundColor=[UIColor clearColor];
UIImage *backgroundImage = [UIImage imageNamed:@"sample2.png"];
UIImageView *backgroundImageView = [[UIImageView alloc]initWithImage:backgroundImage]; 
self.tableView.backgroundView=backgroundImageView;
[backgroundImageView release];
1
votes

First, set the background image for the table's parent view to the image that you want:

[parentView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]];

Then, set the background image for the UITableView to clearColor:

self.tableView.backgroundColor = [UIColor clearColor];

That should solve the problem.

0
votes

Set the opaque property to NO:

[self.tableView setOpaque: NO];
0
votes

Set the tableview's backgroundColor to clearColor and set the tableview's backgroundView to nil and it will show the color of the view on which it was added on to. And if your tableview is a standalone grouped style table view controller, then set its opaque property to NO.

0
votes

You can use these lines instead of the above line to get rid of black color :

UIImage *backgroundImage = [UIImage imageNamed:@"b.jpg"];   
UIImageView *backgroundView = [[UIImageView alloc]initWithImage:backgroundImage];
[self.view addSubview:backgroundView];  
[self.view sendSubviewToBack:backgroundView];