views:

36

answers:

2

I've been trying to add a simple layer to my UITableView and it seems that the layer is drawn over the tableview components. So, is possible to put a layer under the table components or the only way would be to put the tableview into a some kind of view?

A: 

The UITableView is in a view. A UITableViewController is a UIViewController and has a view property. That view array has the tableview in it. You should be able to add your simple subview below the tableView:

[tableVC.view insertSubview:simpleView belowSubview:tableVC.tableView];

If you wanted to add a CALayer that's different. I wasn't sure if you were adding a CALayer or a UIView.

progrmr
I found your reasoning quite interesting. But when I do: NSLog(@"View count: %d", [self.view.subviews count]); the output is 0. So that means the tableview is not inserted in the view. Also I'm on OS 4, but I don't think that change this fact. So, when adding a subview, it's automatically added to the front of the tableview.
AngeDeLaMort
A: 

After rereading the help I found exactly what I wanted:

UIView* simpleView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
tableVC.tableView.backgroundView = simpleView;

So simple...

AngeDeLaMort