Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
MERGME: Updated thanks to diederich's comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jverkoey committed Apr 18, 2011
1 parent 2e0492d commit e827a88
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions src/Three20UI/Sources/TTTableSubtitleItemCell.m
Expand Up @@ -129,34 +129,24 @@ - (void)layoutSubviews {
#pragma mark TTTableViewCell


///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)prepareForReuse {
[super prepareForReuse];

self.textLabel.text = nil;
self.detailTextLabel.text = nil;
self.imageView2.defaultImage = nil;
self.imageView2.urlPath = nil;
}


///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)setObject:(id)object {
if (_item != object) {
[super setObject:object];

TTTableSubtitleItem* item = object;
if (item.text.length) {
self.textLabel.text = item.text;
}
if (item.subtitle.length) {
self.detailTextLabel.text = item.subtitle;
}
if (item.defaultImage) {
self.textLabel.text = item.text;
self.detailTextLabel.text = item.subtitle;

if (item.defaultImage || item.imageURL) {
self.imageView2.defaultImage = item.defaultImage;
}
if (item.imageURL) {
self.imageView2.urlPath = item.imageURL;

} else {
// Subviews are laid out in this cell depending on the existence of the image view.
// If there is no image to be displayed, we remove the image view altogether.
[_imageView2 removeFromSuperview];
TT_RELEASE_SAFELY(_imageView2);
}
}
}
Expand Down

0 comments on commit e827a88

Please sign in to comment.