Storyboard is causing to me a lot of problems! :(
Now I'm trying to put an image as a background of a tableview in iOS. I've done a png image with transparency in photoshop and I've imported it into my project.
** The first question is: is it possible to set the image background in storyboard? I thought that a good idea was to create and image view and put it on my table view... but storyboard doesn't allow my to do this.
** I've also tried to add the background image via code:
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"table_background.png"]];
...
}
I obtained an horrible result with a black background instead of white, even if the png is transparent!
Moreover I've read that to optimize performances, it should be better to avoid transparent background for cells.
So, what it the best way to set an image as a background for a table view with storyboard?
Thank you in advance, yassa
I think you have a method to set a background view for a tableView
[ tableView setBackgroundView:<#(UIView *)#> ];
And then add an UIImageView (but only for 3.2+)
Avoid using backgroundColor for this kind of things ^^
Using only story board I don't know :-] but with this method it should work.
Btw check that your tableView & cell have a clear backgroundColor, may be the problem too.
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With