开发者

Trouble controlling the AccessoryType

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜