ios - UITableview Insert/Delete -


i having 1 number of section base tableview in plus button add new item in tableview.
while try add or delete section tableview , reload tableview blink old record many times , add or delete section.
here code.

 -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     symboltableviewcell *cell = [tableview cellforrowatindexpath:indexpath];     if ([selectindexpath containsobject:[nsnumber numberwithint:(int)indexpath.section]])     {         [selectsymbol removeobject:cell.lblsymbol.text];         [selectindexpath removeobject:[nsnumber numberwithint:(int)indexpath.section]];     }     else     {         nsstring *strr = cell.lblsymbol.text;         [selectsymbol addobject:strr];         [selectindexpath addobject:[nsnumber numberwithint:(int)indexpath.section]];     }      [tbldetail reloaddata]; } 


what issue?

try following code may helps you

-(void)tableview:(uitableview *)tableview didselectrowatindexpath: (nsindexpath *)indexpath {   symboltableviewcell *cell = [tableview cellforrowatindexpath:indexpath];   if ([selectindexpath containsobject:[nsnumber numberwithint:(int)indexpath.section]])   {     [tbldetail beginupdates];     [selectsymbol removeobject:cell.lblsymbol.text];     [selectindexpath removeobject:[nsnumber numberwithint:(int)indexpath.section]];     [tableview deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade];     [tableview endupdates];   }   else   {     nsstring *strr = cell.lblsymbol.text;     [tbldetail beginupdates];     [selectsymbol addobject:strr];     [selectindexpath addobject:[nsnumber numberwithint:(int)indexpath.section]];     [tableview reloadrowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade];     [tableview endupdates];   } } 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -