Reputation: 1278
How can I insert an image on simple tableview? I have an tableview but if I insert like this:
self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"image.png"]];
I see the image in every cell that isn't empty the start of the image, and this is horrible!
Thanks for the attention!
Upvotes: 1
Views: 3407
Reputation: 15099
To set the background of a TableViewController you can use this code in the viewDidLoad
method:
self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]];
self.tableView.backgroundColor = [UIColor clearColor];
If you are trying to set an image in the cell itself you can use this code in your tableView:cellForRowAtIndexPath:
method
cell.imageView.image = [UIImage imageNamed:@"image.png"];
Upvotes: 2