TTTableViewCell 中的 TTImageView 单元格重用问题
让我描述一下我使用视频链接时遇到的问题此处
问题在于 TTImageView,它是左边的头像缺少一些图像。 我相信这是因为细胞重复利用?我该如何解决这个问题? 这是我的代码:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier {
if (self == [super initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:identifier]) {
_avatar = [[TTImageView alloc] init];
[self.contentView addSubview:_avatar];
_main_title = [[TTStyledTextLabel alloc] init];
[self.contentView addSubview:_main_title];
_detailed = [[UILabel alloc] init];
[self.contentView addSubview:_detailed];
}
return self;
}
Let me describe the issue that I am having using a video link here
The issue is that the TTImageView, which is the avatar on the left is missing some image.
I believe this is because of cell reuse? How do I fix this?
Here is my code:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier {
if (self == [super initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:identifier]) {
_avatar = [[TTImageView alloc] init];
[self.contentView addSubview:_avatar];
_main_title = [[TTStyledTextLabel alloc] init];
[self.contentView addSubview:_main_title];
_detailed = [[UILabel alloc] init];
[self.contentView addSubview:_detailed];
}
return self;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Three20 在表格单元格中的prepareForReuse 函数方面存在一些问题。例如,请参阅 https://github.com/facebook/third20/issues/497 。
您现在可以做什么,创建您自己的表项单元格子类并具有prepareForReuse 函数。
我实际上发现使用自己的 TTImageView 更容易,而不是使用现有的 _imageView TTImageView
Three20 has some issues with prepareForReuse function in the table cells. see https://github.com/facebook/three20/issues/497 for example.
What you can do now, to create a table item cell subclass of your own and have a prepareForReuse function.
I actually found that it's easier to use my own TTImageView, and not to use the existing _imageView TTImageView