2011-07-01 1 views
1

나는 다음과 같은 코드가 있습니다TTTableItem 이미지 크기

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

이미지 URL에 설정된 이미지 크기를 조정하는 방법이 있나요를?

답변

1

당신은 TTTableSubtitleItemCell의 사용자 지정 하위 클래스를 생성하고 이미지 뷰의 프레임을 조정해야합니다.

는 TableCustomSubtitleItem라는 이름의 서브 클래스 TTTableSubtitleItemCell 클래스를 생성하고 클래스에 새로운 레이아웃 파단 기능을 추가, 기본 TTTableSubtitleItemCell 대신 새 TTTableItemCell을 사용할 필요가 데이터 소스에서

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

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

:

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