ios - Swipe to delete reveals label that should be hidden in cell -
ios - Swipe to delete reveals label that should be hidden in cell -
i been having lot of issues trying implement expandable cell app. problem @ moment although code works intended expanding , collapsing cell, shows content should hidden when swiping delete looks terrible.
another issue when tap navigation button segue away tableview, 1 of cells expand. also, when tapping cell, seems loose dividing line @ top until different cell tapped. (these issues more minor. first issue mentioned more major.)
this code in didselectrowatindexpath:
var selectedrowindex: nsindexpath = nsindexpath(forrow: -1, insection: 0) override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { selectedrowindex = indexpath tableview.beginupdates() tableview.endupdates() }
this code in heightforrowatindexpath:
override func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat { cellheight = 68 if tableview != self.searchdisplaycontroller?.searchresultstableview { if indexpath.row == selectedrowindex.row { if celltapped == false { celltapped = true cellheight = 141 homecoming 141 } else { celltapped = false cellheight = 68 homecoming 68 } } } homecoming 68 }
and in cellforrowatindexpath:
if cellheight == 141 { cell.noteslabel.hidden = false println("false") } else if cellheight == 68 { cell.noteslabel.hidden = true println("true") }
at moment, code seems create cell.noteslabel always hidden cellforrowatindexpath doesn't seem called when tapping cell.
does have solution issue or improve implementation? i'm sure there must easier way of doing this.
i consider looking auto resizing cells.
tableview.estimatedrowheight = 44.0 tableview.rowheight = uitableviewautomaticdimension
as content changes must reload cell , animate it, think improve implementation of using:
reloadrowsatindexpaths(_ indexpaths: [anyobject], withrowanimation animation: uitableviewrowanimation)
it sounds have lot of gestures going on , contributing problems. draggable cells, create sure contentview pan gesture changing offset of, or if have of cell's content in view, create sure applied view.
ios xcode uitableview swift
Comments
Post a Comment