views:

265

answers:

1

Hello all ,

I have seen some iPhone apps in which they show first section of rows after loading Other sections of rows will not be visible until you tap them .

If you want to see more data you have to tap on that particular section so it will collapse and show rows of data .

some unclear idea :

- (void)beginUpdates;
- (void)endUpdates;

- (void)insertSections:(NSIndexSet *)sections withRowAnimation: (UITableViewRowAnimation)animation;
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation: (UITableViewRowAnimation)animation;

- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;

But don't know How to detect tap on section headers ?

Any one knows how can I do so ?

i.e How to implement collapsable sections in uitableview ?

Thanks .

+1  A: 

But don't know How to detect tap on section headers ?

==> Implement a custom view for the sectionheader (table delegate viewForHeader) and put a button in it.

i.e How to implement collapsable sections in uitableview ? ==> Use insert/delete rows methods in your method called by the header button ==> be sure to keep your numberOfRows method up to date

It's quite straight forward if you always hide/show all rows. More tricky if you show/hide specific rows.

Gerd