I am implementing an optional delegate method on the Cocoa Touch API. What I would like to do is, first call the method that would have been called if I didn't implement the delegate ... then make changes to the result ... then return my modified version.
Here's an example:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; {
/* this line: */ UIView * headerView = [someObject tableView:tableView viewForHeaderInSection:section];
[headerView setBackgroundColor:[UIColor redColor]];
return headerView;
}
The marked line doesn't work. I could put someObject = tableView.delegate, but that just gives me infinite recursion. Is there some trick to make the tableView do whatever it would do if the optional method weren't implemented? I'm not super hopeful, but it would be cool if possible.