views:

17

answers:

1

hi guys

a new problem has crept up for me.I want to set an image as a table's background.Its a grouped table view.im doing this using IB.

i set the background color property for the table view as clearcolor and placed tan image view in the view on which the table view is placed./it looks good on ib,but when the application is loaded the table has a white background.

im going nuts.:-(Help

A: 

Are you using a UINavigationController? If yes, I use this code:

self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"nameOfYourImage.png"]];

I placed this code in the viewDidLoad method.

Matthew
err... i forgot to mention that was using a navigation controller.Let me try this.
Mithun Madhav
@matthew:I tried it. its not working..Cant see what the problem could be!
Mithun Madhav
@Mithun have you restore the nib modified in IB? Dlete the imageView and try again... This code works great for me...
Matthew
@Matthew ive got it working after some modifications.But there are small black areas visble at the corners of each section.Thats preventing me from using any picture that is not blackish as the background.Any ideas on this??
Mithun Madhav
@Mithun sorry for the delay... Unfortunately I have no ideas to solte this mistake... Try to read this post for find the solution: http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html ;)
Matthew