tableView:viewForHeaderInSection: is a UITableViewDelegate method for creating a title view for display. This means, however, that the view has not been added to the view hierarchy, which makes it useless for your purposes.
Try
UIView *headerView = [tableView headerViewForSection:sectionIndex];
instead of this. From there, you can try the following methods on the returned view to get a direct view in any other coordinate system of the view:
[headerView convertRect:[headerView bounds] toView:[headerView window]];
source share