ios - UITableview HeaderView reloading -
i have created dropdown tableview multi sections & each section 1 header view. tapping button in header view, inserting 1 row section & tapping on same button in removing row section.
on removing row section. dequeued headerview getting changes custom view native view.
code :
[self.rtable registerclass:[headercell class] forheaderfooterviewreuseidentifier:@"cellheader"]; - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section{ headercell *detailview = nil; detailview = (headercell *)[tableview dequeuereusableheaderfooterviewwithidentifier:@"cellheader"]; return detailview; }
button action function :
-(void)detailviewbuttonselectedatindex:(int)index; { if(selectedsection != -1){ previousselected = selectedsection; [self.rtable beginupdates]; [self.rtable deleterowsatindexpaths:[nsarray arraywithobject:[nsindexpath indexpathforrow:0 insection:previousselected]] withrowanimation:uitableviewrowanimationfade]; [self.rtable endupdates]; selectedsection = -1; headercell *view = (headercell *)[self.routetable headerviewforsection:previousselected]; [view.routecell.detailbutton setimage:[uiimage imagenamed:@"more"] forstate:uicontrolstatenormal]; } if(previousselected != index){ selectedsection = index; [self.rtable beginupdates]; [self.rtable insertrowsatindexpaths:[nsarray arraywithobject:[nsindexpath indexpathforrow:0 insection:selectedsection]] withrowanimation:uitableviewrowanimationmiddle]; [self.rtable endupdates]; previousselected = -1; }else{ previousselected = -1; } }
Comments
Post a Comment