2011-07-04 3 views
0

テキストが複数の行に折り返されるテーブル行を実装する際に問題があります。また、左側にイメージがあり、右側に開示用アクセス権があります。複数行のテーブル行で画像を拡大するのを停止しますか?

複数行のテキストは問題ありませんが、複数行のテキストがある場合、imageViewは右側に展開されます。すべての行の画像を同じサイズにしたい。私はUIViewAutoresizingNoneにautoresizingMaskを設定しようとしましたが、これは動作しないようです..私はcontentView、またはnibファイルを使用する必要がありますか?

ヘルプ/サンプルコードありがとうございました!

+0

あなたがテーブルビューに表示するのUITableViewCellやカスタムセルを使用している参照してください? – iMOBDEV

答えて

0

画像のサイズが異なる場合は、ImageViewをセルに追加することを検討してください。イメージビューに応じてラベルを保持します。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    UITableViewCell *cell; 

    UIImageView *cellImage; 
    UILabel *label; 
    UILabel *detailLabel; 

    cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; //Create cell 
    if(cell == nil) 
    { 
     cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"] autorelease]; 

     cellImage = [[[UIImageView alloc] initWithFrame:CGRectMake(3, 3, 44, 44)] autorelease]; 


     label = [[[UILabel alloc] initWithFrame:CGRectMake(55, 4, 260, 20)] autorelease]; 
     label.font = [UIFont boldSystemFontOfSize:15.0]; 
     label.tag=25; 

     detailLabel = [[[UILabel alloc] initWithFrame:CGRectMake(55, 25, 260, 15)] autorelease]; 
     detailLabel.font = [UIFont systemFontOfSize:13.0]; 
     detailLabel.tag=30; 

     [cell.contentView addSubview:cellImage]; 
     [cell.contentView addSubview:label]; 
     [cell.contentView addSubview:detailLabel]; 
     cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator; 

    } 
    else 
    { 
     cellImage = (UIImageView *)[cell.contentView viewWithTag:20]; 
     label = (UILabel *)[cell.contentView viewWithTag:25]; 
     detailLabel = (UILabel *)[cell.contentView viewWithTag:30]; 
    } 
    cell.image = [arrayContainingImages objectAtIndex:indexPath.row]; 
    label.text =[arrayContaininglabeltext objectAtIndex:indexPath.row]; 
    detailLabel.text=[arrayContainingDetailLabelText objectAtIndex:indexPath.row]; 
    return cell; 
} 
関連する問題