2

I have a strange situation, in some cases I want to disable cell reusable "feature" in the cell. If some condition met I dont' wan't reuse that cell.

What is the beautiful method for this?(I know the purpose of the reuseIdentifier, but I have some strange dependency so, no I want from this cell to become none reusable.)

I can't modify the reuseIdentifier because it is a read only property. I can override the getter "- (NSString *)reuseIdentifier", but I don't like this idea.

Any other suggestion for this problem?

4

1 回答 1

8

如果您需要避免重用单元格,那么您的代码或设计有问题:重用单元格的机制非常灵活,您应该能够根据需要对其进行调整。

但是,您想要的效果相对容易实现:如果dequeueReusableCellWithIdentifier:返回一个您不想重用的单元格,请不要从您的tableView:cellForRowAtIndexPath:方法中返回该单元格。在其位置创建一个新单元格,或将另一个单元格出列。

于 2013-07-24T11:33:54.830 回答