Wrapping the tableView in a custom view in UITableViewController
Ever wanted to add a different view north of your table view without making it the tableHeaderView?
Here’s what you need:
@property (nonatomic, retain) UITableView *internalTableView;
- (void)loadView;
{
[super loadView];
self.internalTableView = self.tableView;
self.view = [[[UIView alloc] initWithFrame:self.view.frame] autorelease];
[self.view addSubview:self.tableView];
self.tableView.frame = self.view.bounds;
}
- (void)viewDidUnload;
{
self.internalTableView = nil;
[super viewDidUnload];
}
- (void)dealloc;
{
internalTableView = nil;
[super dealloc];
}
// here's the finesse
- (UITableView *)tableView;
{
if (!self.internalTableView) {
return [super tableView];
}
return self.internalTableView;
}
everydaypanos 14:56 on 7. August 2010 Permalink
Why write code for “clients” when you can write for yourself. Plus you skip the annoying explanations to others.
(I would like to suggest that you also use Rewrd as a Micropayments Service for your blog. Thx.)