Re: UITableView Custom Section Headers
Re: UITableView Custom Section Headers
- Subject: Re: UITableView Custom Section Headers
- From: Luke Hiesterman <email@hidden>
- Date: Mon, 27 Dec 2010 07:15:14 -0800
On Dec 27, 2010, at 2:30 AM, ico <email@hidden> wrote:
> Hi,
> I don't know if you have figured this out. I also want to know how to do the
> customization
> on the section part of the tableview, not the cell but the section part. I
> want to put some
> custom content including an image on my section header rather than just some
> text.
>
> Can anyone tells me how to do this? Thanks.
>
> 2010/8/17 Luis Israel Pasos Peña <email@hidden>
>
>> I was creating an RSS reader that I thought was really cool, but then I saw
>> Jason Beaver's and Luke Hiesterman's presentation at WWDC 2010 and I went...
>> OK that's cooler.
>>
>> So basically, I'm stuck with a couple of things in the new version of the
>> RSS reader:
>>
>> 1. I'm implementing UIViewControllers as custom section headers, but I
>> don't know if this is the best approach. What I'm trying to do is to add an
>> Activity indicator , label and a reload button to each header so that the
>> user is able to reload a feed directly from each header. Also, the
>> allocations of the headers seem to happen every time I scroll through the
>> UITableView, I figure this isn't good at all.
You should not be using view controllers for the section headers. Remember that view controllers are designed around screenfuls of content - not to manage some subview of your table. Therefore you might be using a UITableViewController for the current screen, but for implementing your custom headers, all you will be doing is creating a custom subclass of UIView.
As for the allocation problem, feel free to cache your custom header views if that makes sense for your application. Then when we ask for the header again, you can return the cached version.
>>
>> 2. I need to retrieve only the feed particular to that specific section and
>> then replace it on the tableview. To do this I need the section number. How
>> can I get the section from the tap on the section header?
There's more than one way to skin this cat, but in my demo app, I simply assigned the section number as a property of the custom header view when I created it. That way, when it was tapped it could send a message back to the view controller that included its section index.
>>
>> I don't know if Luke is still on this list, and I also know this is might
>> be too much to ask, but is there anyway we could take a look at the
>> TableViewUpdates project, much like Francois Jouaux did with Padalicious?
>> Maybe not all of it, just the part related to the headers?
>>
This project has been made into sample code on developer.apple.com. https://developer.apple.com/library/ios/samplecode/TableViewUpdates/
Luke_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden