ios - Better way to hide a cell which doesn't make a condition (UITableView) -


i have uitableview hides cells aren't within radius (slider double). im doing setting working out distance setting height of cells match if statement return 0. throws bunch of constraint errors , don't believe best way it.

so question is, there better cleaner , more elegant way achieve same, hiding cell result?

current height function

func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat {          if usercurrentlocation != nil {             let celldata = cachedata[indexpath.row]             //let radius: double = radiusslidervalue              if celldata.distance > radiusdata.radiusvalue {                 return 0             }         } 

a better approach distance calculation before tableview loaded, , put valid data different array tableview works off, you're ever presenting rows valid.

if data change once tableview has loaded , don't want reload whole table, can use insertrowsatindexpaths:withrowanimation: , deleterowsatindexpaths:withrowanimation: on tableview add new rows in.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -