I add header and footer view while creating my table.
What I want to do is to change the content of the footer dynamically and programmatically.
Is there a standard way to get the UIView for footer?
I know there is a way which is to add a UIView property and assign the foot UIView while it is created in - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
but I would like to know whether there is a better way to do this.
You could tag your custom section footer view when you create it, e.g., in
tableView:viewForFooterInSection:, like this:kMySectionFooterViewTagcan be anyNSIntegeryou like.To access
mySectionFooterViewfrom some other part of your program you can then use:myTableViewis theUITableViewthat includes your custom section footer view. You can typically accessmyTableViewasself.tableView, when using aUITableViewController.Note that there can be performance considerations with this approach, because
viewWithTag:will search the entire view hierarchy ofmyTableView.