Have a UITableViewCell show the delete button without the red minus
ios, objective-c, uitableview
Solution
Just an approach:
- Have a delete button on a view and assign a method to it
- In this method, toggle a BOOL `isDeleteEnabled` (or whatever you name it) to `TRUE`
- Reload the `UITableView` and in `cellForRowAtIndexPath` check for that BOOL value
- If `TRUE` then load the all the `UITableViewCell` as custom cells with delete button on it (You need to set the selector method for deletion of a row)
- Delete as many cells as you want by tapping that button on the cells
- After deleting your choices you can again press the main button and toggle the value for `isDeleteEnabled`
- Again reload `UITableView` and this time in `cellForRowAtIndexPath` check the value of `isDeleteEnabled` - which will be `FALSE`. So, you need to load normal(or your original) UITableViewCells.
I have done the very similar thing following this approach.
Also, I haven't posted the code for it for three reasons:
- It would be too lengthy in size
- The code his available at my work machine (to which I am not having access right now)
- It will ruin the joy of coding such a task. Do it yourself. You will enjot it.
Problem
I want to implement a `UITableView` that when I press a button in my `ViewController`, I can see the delete button on the right of the cell, but not the red minus circle on the the left of the cell. Any ideas on this?