Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tableView backgroundView is not working in iOS7

I am setting a view as a background for uitableview. View simply has colorWithPatternImage.

It is working correctly in iOS6, But in iOS7, it dont have any effect, TableView background remains just white in iOS7. I am using Three20 library.

My code is

UIImage *imgBackGround = [UIImage imageNamed: @"my_background.png"];
self.tableView.backgroundColor = [UIColor clearColor];

UIView *backView = [[UIView alloc] initWithFrame:self.view.frame];
[backView setBackgroundColor:[UIColor colorWithPatternImage:imgBackGround]];
self.tableView.backgroundView = backView;
[backView release];
self.view.backgroundColor=[UIColor colorWithPatternImage:imgBackGround];

What can be issue in iOS7 ? Help please, Thanks in advance.

like image 398
sourabhkumbhar Avatar asked Oct 09 '13 09:10

sourabhkumbhar


1 Answers

In iOS 7, tableview's cell automatically have a white background color. You need to clear the cell's color and background.

cell.backgroundColor = [UIColor clearColor];
cell.backgroundView =  [UIView new];

Use in cellForRowAtIndexPath

This will surely solve it.

like image 54
iOS_DEV Avatar answered Oct 23 '22 20:10

iOS_DEV