How can we check the box in uitableviewcell

I created a todos list. Now I want to check the box for each cell. When I mark it as marked, it can be marked, and then we select the delete button if we want, which is also in the same cell on the right side and is deleted, but I cannot perform such actions.

Can anybody help me?

+3
source share
3 answers

@Chakradhar is not a big problem, you can do it very easily with or without using custom images .. in your deletion, didSelectRowAtIndexPathtry to check and give UITableViewCellAccessoryaccording to your condition .... this is a way in which there is no need to use additional images, and you You can check for a specific selected cell.

if (//here you check)
    { // item needed - display checkmark
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }
    else
    { // not needed no checkmark
        cell.accessoryType = UITableViewCellAccessoryNone;
    }

Take this shopping tutorial and see the didSelectRowAtIndexPathdelegate method to find out how they used this condition.

Edited according to your last comment: For a custom look for accessories, search for Custom Access View View for UITableView on iPhone

Good luck

+17
source

Use this

cell.accessoryType = UITableViewCellAccessoryCheckmark;
+2

In fact, you can add a custom buttom with an unverified image on your cell. In the button action method, you can change the image to check and process the rest of the things you want to handle

0
source

Source: https://habr.com/ru/post/1795155/


All Articles