adit
adit

Reputation: 33674

TTTableItem image size

I have the following code:

TTTableItem *item = 
        [TTTableSubtitleItem 
         itemWithText:group.name
         subtitle:[NSString stringWithFormat:@"%@ members %@ topics ", group.members_count , group.topics_count]
         imageURL:imageURL
         URL:@""
         ];

Is there a way to resize the image set in the imageURL?

Upvotes: 1

Views: 273

Answers (1)

aporat
aporat

Reputation: 5932

You will have to create a custom subclass of TTTableSubtitleItemCell and adjust the frame of the image view.

create a subclass TTTableSubtitleItemCell class, named TableCustomSubtitleItem , and add a new layout subviews function in your class:

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

  if (_imageView2) {
   _imageView2.frame = CGRectMake(0, 0, 100, 100);
  }
}

In your data source, you need to use your new TTTableItemCell instead of the default TTTableSubtitleItemCell:

///////////////////////////////////////////////////////////////////////////////////////////////////
- (Class)tableView:(UITableView*)tableView cellClassForObject:(id) object { 
   if ([object isKindOfClass:[TTTableSubtitleItem class]]) {
    return [TableCustomSubtitleItem class];
   } else {
    return [super tableView:tableView cellClassForObject:object];
   }
}

Upvotes: 1

Related Questions