0

I have a UITableView with dynamic rows and one static row. I have a long press gesture to reorder the rows.

My problem is that the static row, which is meant to be the last row of the tableView cannot be reordered. So how could I not trigger the gesture on this particular row and make it impossible to drag the rows under this one? Is it something I should implement in my reordering methods (I actually use an external library) or is there a way to deactivate the gesture and to say that the last row of my tableView is the last dynamic row and not the static one?

Nico
  • 6,269
  • 9
  • 45
  • 85
  • 1
    Can you show the code you use to trigger the reordering? It should probably be possible to check which row is being moved in that piece of code, or if it is triggered by an event listener on the row itself, to override it in that particular row to do nothing. – Erik S Mar 25 '15 at 22:49
  • http://stackoverflow.com/a/8852873/396569 Could be helpful. – Dae KIM Mar 25 '15 at 23:00
  • 1
    Why not use a footer instead of complicating the row logic? – Joel Mar 25 '15 at 23:15
  • DanielKIM thanks, the method tableView:canEditRowAtIndexPath indeed helped me to remove the gesture from the last row but not the problem with the last dynamic row having the last index. A footer is the solution in my case indeed. @Joel simply because... I was not aware of such a thing for UITableView. Thanks a lot! And by the way, to add an action on the footer, I guess I have to custom it with a button or is there another way? – Nico Mar 26 '15 at 00:14
  • @Joel well it seems actually that it's not really what I'm looking for as if there are more rows than what can be displayed, the footer is not hidden, it's at the bottom of the displayed rows. I would like to see it only when I reach the end of the tableView by scrolling (or if all the rows can be displayed at same time, including the footer). Is that possible with a footer? – Nico Mar 26 '15 at 04:14
  • Are you using a table footer or section footer? http://stackoverflow.com/questions/5740518/uitableview-footer-stop-from-floating-over-content – Joel Mar 26 '15 at 04:19
  • @Joel I'm using a section footer (viewForFooterInSection). This footer is a custom UITabelViewCell that I casted into UITableViewHeaderFooterView in the IB. I get then the footer using tableView.dequeueReusableHeaderFooterViewWithIdentifier("Footer") as UITableViewHeaderFooterView. Another weird thing is that I don't get any of the views I set in the footer in the Interface Builder, it's just an empty rectangle. – Nico Mar 26 '15 at 05:06

0 Answers0