开发者

Trouble controlling the AccessoryType

开发者 https://www.devze.com 2023-03-02 22:09 出处:网络
Hey guys, I have an table in which the user can tap on items to get a checkmark in the accessoryType [cell setAccessoryType:UITableViewCellAccessoryCheckmark];

Hey guys, I have an table in which the user can tap on items to get a checkmark in the accessoryType

        [cell setAccessoryType:UITableViewCellAccessoryCheckmark];

It all works just fine, however the problem is appearing when i want to delete a cell. I am unsure how I remove the cell's accessoryType when i am deleting it, since if i dont it stays in the table, and possible places itself on a row which had no开发者_高级运维 checkmarks before.

Like this, if i am deleting the first box to the left.

[X] [O] [X] [X] --> [X] [X] [X]


I assume you're talking about dequeueing a reusable cell and seeing the accessory checkmark already set on it from a recycled deleted row.

Every time you configure a cell in -tableView:cellForRowAtIndexPath:, just make sure you explicitly set its accessory type. That way it's never random.

You can clear it by setting it to UITableViewCellAccessoryNone.

0

精彩评论

暂无评论...
验证码 换一张
取 消