Question

iwas reading about the tableView protocol in the iOs 4.2 documentation, and i found this sentence, which refers to the "tableView:viewForHeaderInSection:" paragraph:

Discussion The returned object, for example, can be a UILabel or UIImageView object. The table view automatically adjusts the height of the section header to accommodate the returned view object. This method only works correctly when tableView:heightForHeaderInSection: is also implemented.

It doesn't seem to you a little bit misunderstanding?

Was it helpful?

Solution

Yes, it sounds a bit misleading. In fact they say 2 things:

1) We make the header the height of the object you returned for tableView:viewForHeaderInSection:
2) We make the header height you returned in the method tableView:heightForHeaderInSection:.

These are two quite different. But the correct conclusion is:

1) You have to implement heightForHeaderInSection.
2) Your height for each section will be adjusted for the object you return if it is not accommodate to the size you defined in heightForHeaderInSection:.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top