IPhone: Grouped TableView background image problem

Hello everyone, it seems like it should be simple; I really hope so. As always, thanks in advance!

All I'm trying to do is add a background image to a grouped tableview style. I use the following method in viewDidLoad:

self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];

Unfortunately, background.png seems to be drawn not only by cells, but also against the background of cells and headers as follows:

alt text http://www.freeimagehosting.net/uploads/194449ffc1.png

I know that on this site there are several questions devoted to similar problems, but I am afraid that I can’t work. How to set background UITableView (tableview style - "Grouped") to use image? made me add

self.tableView.opaque = NO;
self.tableView.backgroundView = nil;

to view DidLoad and add

cell.backgroundView = nil;
cell.opaque = NO;

. , .

cell.backgroundColor = [UIColor clearColor];

. , , . , , . , . , , . !

* * * : * * *

, . DidLoad:

    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    bgView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
    [self.tableView.window addSubview:bgView];

    [self.tableView addSubview:bgView];
    [self.tableView sendSubviewToBack:bgView];

, , , , , , : alt text http://www.freeimagehosting.net/uploads/c02dd68e20.png

, , - , . . .

, : UIView UITableView UITableViewController

+3
5

, , , , subView App Delegate tableView, .

, , , , . , - , , . !

0

, . , :

UITableView ?

, rkb. :

self.tableView.backgroundColor = [UIColor clearColor];

self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithData:imageData]];
+4

, . ViewDidLoad:

UIImage *background = [UIImage imageNamed:@"MyBackground.png"];
self.tableView.backgroundView = [[UIImageView alloc] initWithImage:background];

( ) , .

+3

( , dana_a), , ,

self.tableView.backgroundColor = [UIColor clearColor]; self.parentViewController.view.backgroundcolor = [UIColor colorWithPatternImage: [UIImge imageNamed: @ "bgtest2.png" ]];

WillAppear: - .

+2

ViewDidLoad, .

self.termsTableView.backgroundColor = [UIColor clearColor];

self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"metal4.png"]];
+1

Source: https://habr.com/ru/post/1757593/


All Articles