开发者

reuse cell in three20

开发者 https://www.devze.com 2023-03-22 11:25 出处:网络
In my - (void)setObject:(id)object method, sometimes I am adding a 0..10 UIImageView dynamically to the cell depending on the object. Now the issue is how do I remove these开发者_开发知识库 UIImageVie

In my - (void)setObject:(id)object method, sometimes I am adding a 0..10 UIImageView dynamically to the cell depending on the object. Now the issue is how do I remove these开发者_开发知识库 UIImageView from the cell in my prepareForReuse?

I have tried doing it via a stupid way, which is to tag each UIImageView from -1 to -10, then in my prepareForReuse I check if it exists, if it does I remove it and then check for the next one. Is there any easier method than this?


You should make each cell contain spots for every imageview you want to display in its own subclass. When you implement prepareForReuse in your subclass, set them all to hidden, and in your setObject call, determine which ones need to be unhidden.


Try this

- (void)prepareForReuse {
    [super prepareForReuse];
    [_photoImage unsetImage];   
}
0

精彩评论

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