I know this question was for iOS 5, but for the benefit of future readers, note that effective iOS 6 we can now use dequeueReusableHeaderFooterViewWithIdentifier
instead of dequeueReusableCellWithIdentifier
.
So in viewDidLoad
, call either registerNib:forHeaderFooterViewReuseIdentifier:
or registerClass:forHeaderFooterViewReuseIdentifier:
. Then in viewForHeaderInSection
, call tableView:dequeueReusableHeaderFooterViewWithIdentifier:
. You do not use a cell prototype with this API (it's either a NIB-based view or a programmatically created view), but this is the new API for dequeued headers and footers.