2012-01-26 24 views
0

tableViewControllerを作成し、最後のセルを大きくする必要があります。しかし、私は望むようにサイズを設定することはできません。ここに私のコードUITableViewでセルのサイズを変更できません

cell.bounds = CGRectMake(0,45,320,900); 
     [[cell.contentView viewWithTag:indexPath.row]removeFromSuperview] ; 
     CGRect frame = CGRectMake(20, 20, 400, 500); 
     CGRect frame2 = CGRectMake(0, 0, 400, 500); 
     [cell setFrame:frame]; 
     [cell setBounds:frame2]; 

     //[self tableView].rowHeight = 500; 
     UITextView *txtView = [[UITextView alloc] initWithFrame:frame]; 
     txtView.text = @"SEND FROM MY IPAD"; 
     txtView.textAlignment = UITextAlignmentLeft; 
     [cell.contentView addSubview:txtView]; 
     [txtView release]; 

しかし、私はいくつかのピクセルのための高さを変更することができますし、すべての(enter image description here

答えて

1

あなたが行(セル)の高さを変更するためにUITableViewDelegateプロトコルを実装する必要があります。方法tableView:heightForRowAtIndexPath:を参照してください。

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 
    return 100.0f; 
} 

幅を変更するには、UITableViewの幅を必要な値に設定してください。

関連する問題