I'd like to return nil
to tableView:heightForFooterInSection:
but that's not allowed. Is there a way to return nil
as a CGFloat?
Why are you doing this?
I'm testing how a tableView will behave with a mix of Titles and Views as sectionFooters. For one footer I need to use a custom view, but for another footer I have 3 or 4 sentences of text and I like how the system styles it and sizes the footer to fit. But as soon as I implement heightForFooterInSection
(which is required by viewForFooterInSection
), the footer with the title no longer auto-resizes to fit the given text. I'm trying to avoid building a custom view for the straight text.
There's no such thing as nil
for primitive values. You could try returning 0.0f
, but I don't know how UITableView responds to that. It may just hide the view entirely. Presumably if you want to return a custom view for one footer, you need to return a custom view for all footers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With