UITableView backgroundView
@property(nonatomic, readwrite, retain) UIView *backgroundView
Discussion of [UITableView backgroundView]
A table view’s background view is automatically resized to match the size of the table view. This view is placed as a subview of the table view behind all cells , header views, and footer views.
Assigning an opaque view to this property obscures the background color set on the table view itself.
UITableView backgroundView example.
UITableView has a backgroundView property. Use it.
aTableView.backgroundView = [[[UIView alloc] initWithFrame:aTableView.bounds] autorelease];
aTableView.backgroundView.backgroundColor = backgroundColor;
aTableView.backgroundView = [[[UIView alloc] initWithFrame:aTableView.bounds] autorelease];
aTableView.backgroundView.backgroundColor = backgroundColor;
Example of [UITableView backgroundView].
a better solution using UITableView.backgroundView:
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"lisbon.png"]];
self.tableView.backgroundView = imageView;
[imageView release];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"lisbon.png"]];
self.tableView.backgroundView = imageView;
[imageView release];
UITableView backgroundView example.
Please use following code.
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TableViewBackground.png"]];
[tempImageView setFrame:self.tableView.frame];
self.tableView.backgroundView = tempImageView;
[tempImageView release];
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TableViewBackground.png"]];
[tempImageView setFrame:self.tableView.frame];
self.tableView.backgroundView = tempImageView;
[tempImageView release];