uitableview - How can I reload immediately my UITableViewCell in Swift? -
class droptvviewcontroller: uiviewcontroller , uitableviewdatasource, uitableviewdelegate { @iboutlet weak var tableview: uitableview! var datatransfer = datatransfer() var responsestring : string = "" let storedata = storedata() override func viewdidload() { super.viewdidload() tableview.delegate = self tableview.datasource = self let pfod = postfordata() pfod.fordata { jsonstring in self.responsestring = jsonstring string var dict = self.datatransfer.jsontoarray(self.responsestring)! if let x: anyobject = dict.valueforkey("readlist") { println( dict.count ) println("x + \(x)") var = 0 ; < dict.count-1 ; i+=2 { println("i : \(i)") let y: anyobject = x.objectatindex(i) let z: anyobject? = y.objectforkey("epipic") let title : anyobject? = y.objectforkey("epititle") let time : anyobject? = y.objectforkey("droptagcreatetime") let pg : anyobject? = y.objectforkey("pgname") var imagessss = uiimage (data : pfod.forpicture()) self.storedata.add(title as! string, afs: pg as! string, ats: time as! string, ph: imagessss! , field1s: z as! string, field2s: z as! string, field3s: z as! string, field4s: z as! string ) // reload in here,but delay ten seconds. // sure data ready read self.tableview.reloaddata() } } } }
you can use self.tableview.reloaddata() doing, in wrong part of loop. move outside , should fine :)
if you're looking reload specific table cell try: self.tableview.reloadrowsatindexpaths(paths, withrowanimation: uitableviewrowanimation.none)
answer taken here: https://stackoverflow.com/a/26709571/4891259
Comments
Post a Comment