Reputation: 1864
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!!
Upvotes: 0
Views: 1063
Reputation: 1864
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.
Upvotes: 4