objective c - Load a custom XIB for expanded cell in tableView iOS? -



objective c - Load a custom XIB for expanded cell in tableView iOS? -

i trying load expanded cell xib uitableviewcell when selected.the content of normal cell , expanded cell same except space populate views in expanded cell.now differentiate between normal cell , expanded cell have changed uilabel colors within expanded cells different color.i able load expanded cell xib on clicking cell however problem every cell getting replaced expanded cell xib .the difference height of clicked cell more others .and when click expanded cell, normal cell xib's loaded again.how can load expanded cell xib clicked cell? or there improve way accomplish thing?

here's how expanding cell.

-(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ if ([self.expandedcells containsobject:indexpath]) { [self.expandedcells removeallobjects]; isexpanded = no; [self.bustableview beginupdates]; [self.bustableview reloaddata]; [self.bustableview endupdates]; }else{ isexpanded=yes; if (self.expandedcells.count>0) { [self.expandedcells removeallobjects]; } [self.expandedcells addobject:indexpath]; expcell.expcontainer.hidden=yes; //some more code [self.bustableview beginupdates]; [self.bustableview reloaddata]; [self.bustableview endupdates]; } }

and cellforrow method looks this.

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ if (!isexpanded) { //bool variable set no in viewdidload buslistcell *cell =(buslistcell*) [tableview dequeuereusablecellwithidentifier:nil]; if (cell==nil) { nsarray *nibs = [[nsbundle mainbundle]loadnibnamed:@"buslistcell" owner:self options:nil]; cell = nibs[0]; } cell.busname.text = [[busarray objectatindex:indexpath.row]valueforkey:@"operatorname"]; homecoming cell; }else{ expcell = (expandedcell*)[tableview dequeuereusablecellwithidentifier:nil]; if (expcell==nil) { nsarray *nibs = [[nsbundle mainbundle]loadnibnamed:@"expandedcell" owner:self options:nil]; expcell = nibs[0]; } expcell.bus_name.text = [[busarray objectatindex:indexpath.row]valueforkey:@"operatorname"]; homecoming expcell; } homecoming nil; }

instead of checking in cellforrowatindexpath:

if (!isexpanded) {}

you have check

if (![self.expandedcells containsobject:indexpath]){}

ios objective-c uitableview

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -