twitter-archive / twui

A UI framework for Mac based on Core Animation
Other
2.74k stars 268 forks source link

Inconsistent UITableViewCell state #94

Closed jparishy closed 12 years ago

jparishy commented 12 years ago

I have been in the process of adding multiple selection support to the TUITableView and friends classes, and it seems that the cells do not maintain a consisten state, as far as selection is concerned. Setting the boolean ivar selected in UITableViewCell does not stay consistent throughout the drawing process, ie. in drawRect:. I had to test in drawRect: whether or not the indexPath was in the UITableView's list of selected index paths, an ugly hack.

The code is forked on my account; there may be a more elegant way for you to see it but I'm not familiar enough with git or GitHub to know how to do it.

avaidyam commented 12 years ago

I'd also like to note that for some reason, the reusable cells are swapping around- back and forth. I tested this by setting a custom background color for each (randomized) and a random int as the title, and they're definitely swapping on drags. Am I doing something wrong, or is this expected?

joshaber commented 12 years ago

Cell shouldn't contain state since they can be reused to represent any row. The table view should maintain state per index path and restore it to the cell that represents the index path.