开发者

TTTableItem image size

开发者 https://www.devze.com 2023-03-17 03:33 出处:网络
I have the following code: TTTableItem *item = [TTTableSubtitl开发者_StackOverflow社区eItem itemWithText:group.name

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

精彩评论

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