Reputation: 740
When i'm using UITableViewHeaderFooterView i can access my section header with
MyClass *section = (MyClass *)[self.tableView headerViewForSection:0];
Any way to access sections if i'm using UIView as a subclass instead of UITableViewHeaderFooterView
Upvotes: 0
Views: 118
Reputation:
You could tag your custom section footer view when you create it, e.g., in tableView:viewForFooterInSection:
, like this:
mySectionFooterView.tag = kMySectionFooterViewTag;
kMySectionFooterViewTag
can be any NSInteger
you like.
To access mySectionFooterView
from some other part of your program you can then use:
mySectionFooterView = [myTableView viewWithTag:kMySectionFooterViewTag];
myTableView
is the UITableView
that includes your custom section footer view. You can typically access myTableView
as self.tableView
, when using a UITableViewController
.
Note that there can be performance considerations with this approach, because viewWithTag: will search the entire view hierarchy of myTableView
.
Upvotes: 2