iphone - Dynamic expandable UITableView with sections -
i creating uitableview expandable/collapsable sections.
i data internet in json format, storing in arrays :
{section 1 {s1 data 1, s1 data 2, ... }, section 2 {s2 data 1, s2 data 2, , on}}
sections can alphabetical letters, year number or whatever.
i create table view headers :
gtheaderview *header = [gtheaderview headerviewwithtitle:[nsstring stringwithformat:@"%@", myarray.sectionvalue]]; [header.button addtarget:self action:@selector(togglesection) forcontrolevents:uicontroleventtouchupinside];
this fine, in "togglesection" method, can't find way know witch section have been touched collapsed/expanded.
i know can't send parameters in selector... solution think fit needs ?
thanks in advance !
you can write togglesection
method as:
- (void)togglesection:(id)sender { // send sender object message find out section number here... }
and of course change addtarget
line specify togglesection
method has 1 parameter:
[header.button addtarget:self action:@selector(togglesection:) forcontrolevents:uicontroleventtouchupinside];
Comments
Post a Comment