Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView background image problem

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.

like image 926
joe Avatar asked Dec 31 '25 11:12

joe


2 Answers

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];
like image 75
Anbu Raj Avatar answered Jan 06 '26 22:01

Anbu Raj


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.

like image 20
bryanjclark Avatar answered Jan 06 '26 23:01

bryanjclark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!