开发者

TTTableItem image size

I have the following code:

TTTableItem *item = 
        [TTTableSubtitl开发者_StackOverflow社区eItem 
         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?


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];
   }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜