views:

440

answers:

0

I have a UITableViewController that has a button in the background the size of the screen. The button accepts touch events to hide the keyboard when the user touches outside of the tableView. The UITableView is set to Grouped style and has its backgroundColor set to [UIColor clearColor].

self.tableView.backgroundColor = [UIColor clearColor];


self.backgroundButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.backgroundButton.frame = CGRectMake(0, 0, 320, 460);
self.backgroundButton.backgroundColor = [UIColor clearColor];
[backgroundButton setBackgroundImage :[UIImageimageNamed:@"gradient_bg_320_460.png"] forState:UIControlStateNormal];
[backgroundButton addTarget :selfaction:@selector(textFieldDone:) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:backgroundButton];

When I run the application, everything looks correct. But when I scroll the table view down, then back up again, the background button seems to be drawing on top of the table view. I can even click the part of the button that is showing on top of the table view.

Has anyone else experienced this before? Is there a way I can fix this?