ios - Reload Table view cell with animation (Swift) -


is there way reload specific uitableview cells multiple sections animations?

i've been using:

self.thetableview.reloadsections(nsindexset(index: 1), withrowanimation: uitableviewrowanimation.right) 

this animates cells in section though. other option use:

self.thetableview.reloadrowsatindexpaths(<#indexpaths: [anyobject]#>,                                           withrowanimation: <#uitableviewrowanimation#>) 

edit:

after using reloadrowsatindexpaths

terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of rows in section 1. number of rows contained in existing section after update (5) must equal number of rows contained in section before update (4), plus or minus number of rows inserted or deleted section (0 inserted, 0 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out).'

trying find smooth way of reloading tableview appending objects array.

calling thetableview.reloaddata() before reloadrowsatindexpaths works, animation glitchy. there approach?

why not reload cells directly? indexpath contains section , row keep track of section want reload , fill indexes in array.

var indexpath1 = nsindexpath(forrow: 1, insection: 1) var indexpath2 = nsindexpath(forrow: 1, insection: 2) self.tableview.reloadrowsatindexpaths([indexpath1, indexpath2], withrowanimation: uitableviewrowanimation.automatic) 

based on comment looking change array , have tableview animate in changes. if that's case should consider using beginupdates() , endupdates() uitableviews or nsfetchedresultscontroller handles of update animations cleanly.

self.tableview.beginupdates() // insert or delete rows self.tableview.endupdates() 

i'd recommend using nsfetchedresultscontroller if you're using core data simplifies entire process. otherwise have handle changes yourself. in other words, if array changes need manually remove or insert rows in tableview using beginupdates() , endupdates(). if aren't using core data, study this grasp how it's handled.


Comments

  1. CASINO KIDS IN VENDOR RENTOR RENTOR RENTOR RENTOR RENTOR RENTOR
    The casino 원주 출장샵 is located 정읍 출장샵 in VENDOR RENTOR RENTOR 동두천 출장샵 RENTOR 제주도 출장마사지 RENTOR RENTOR and offers all the 거제 출장샵 amenities that a casino needs.

    ReplyDelete

Post a Comment

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -