2011-01-03 5 views
3

다른 높이의 UITableViewCell로 UITableView를 채우려고합니다. 셀의 높이에 의해 사용되고 있음을 (NSIndexPath *) indexPath 다른 높이의 UITableViewCell

것 같습니다 추천했습니다 : (jQuery과 *)있는 tableView heightForRowAtIndexPath : 나는

  • (CGFloat)있는 tableView에 적당한 크기를 반환하고 프레임 워크는 어딘가에 있지만 대기열에있는 셀은 여전히 ​​같은 크기입니다.

    개별 셀에서도 setFrame :을 사용해 보았지만 여전히 효과가 없습니다. 내가 예를

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
        if (condition 1) 
         return 60; 
        else if (condition 2) 
         return 100; 
        return 44; 
    } 
    
        - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
        { 
    static NSString *CellIdentifier = @"TableViewCell"; 
    
    
        TableViewCell *cell = (TableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
        if (cell == nil) 
        { 
         cell = [[[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
        } 
    
        return cell; 
    } 
    

답변

2

위해 뭔가

실종 것은 그래서, 여기에 거래이다. TableViewCell의 구현에서 복잡한 레이아웃을 만들었습니다. 그리고 실수로 [self.contentView addSubView :] 대신에 [self addSubview :]가있는 UILabels 중 하나에 대해 이것이 범인이었습니다.