0

i'm currently working on an app for iOS 7 and iOS 8 with Xcode 6 build 7 coding with Swift. In one of the view controllers I got a tableview with custom cells, the thing is, that when I set the tableview property editing to "true", nothing occurs, I don't see the delete button, but if I use a default cell instead of mine it works.

I've used all the necessary methods

func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
    return true
}

func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
    if (editingStyle == UITableViewCellEditingStyle.Delete) {
        // handle delete (by removing the data from your array and updating the tableview)
    }
}

func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
    return .Delete
}

but nothing happens, anyone has had the same problem?

Thanks!!

diegomen
  • 1,804
  • 1
  • 23
  • 37
  • I just posted my answer here https://stackoverflow.com/questions/18616951/custom-uitableviewcell-content-doesnt-move-when-editing/60801901#60801901 Size Inspector, change Autolayout to 'Translates Masks into Constraints" – Nick T Mar 22 '20 at 16:33

1 Answers1

4

Ok solved, after all the solution was in front of me all the time, the thing was that in the layoutSubviews method of the cells I was doing things, but I totally forgot to call the super.layoutSubviews, when I did this, everything worked perfect.

diegomen
  • 1,804
  • 1
  • 23
  • 37