2012-03-16 13 views
2

私はテーブルビューの編集時にチェックマークと移動の間の線をどのように表示するのかという問題があります。下の画像と同様です。テーブルビューの編集時に行を表示する方法は?

enter image description here

は、プロセスを説明したり、他の可能な場合のコード例を私に送ってください。

ありがとうございます。

答えて

0

幅が1ピクセル、背景色が灰色のUIViewを作成し、これをチェックマークの右側に追加すると問題ありません。

0

編集オプションがイメージの場合、次のようなコードを使って行を表示できます。

ステップ

1]まず輸入QuartzCore/QuartzCore.h

2]は境界線の幅とあなたの編集画像の境界線の色のプロパティを設定します。

[editImageView.layer setBorderWidth:2.0]; 

[editImageView.layer setBorderColor:[[UIColor grayColor] CGColor]]; 

//If you putting a button for edit then also you can set the same. Just replace the editImageView with your editButton 

は、あなたが欲しいの正確な取得願っています:)これで

5

ルック:!

宣言BOOLチェックを。 .h の値を確認してください。

// This all code in Cell For Row At IndexPath : 

for (UIView *ObView in [cell.contentView subviews]) 

{ 

    [ObView removeFromSuperview]; 
} 

if(checkMark == YES) // you can check here by imdexPath.row. 

{ 
    UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(10,5,150,30)]; 
    lbl.text = @""; 
    [cell.contentView addSubview:lbl]; 

    UIImageView *CheckImage = [[UIImageView alloc]initWithFrame:CGRectMake(160,5,20,20)]; 
    CheckImage.image = [UIImage imageNamed:@""]; 
    [cell.contentView addSubview:CheckImage]; 

    UIImageView *BarImage = [[UIImageView alloc]initWithFrame:CGRectMake(185,5,0.5,30)]; 
    BarImage.image = [UIImage imageNamed:@""]; 
    [cell.contentView addSubview:BarImage]; 

    UIImageView *tblImage = [[UIImageView alloc]initWithFrame:CGRectMake(160,5,20,20)]; 
    tblImage.image = [UIImage imageNamed:@""]; 
    [cell.contentView addSubview:tblImage]; 
} 
else 
{ 
    UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(10,5,150,30)]; 
    lbl.text = @""; 
    [cell.contentView addSubview:lbl]; 

    UIImageView *tblImage = [[UIImageView alloc]initWithFrame:CGRectMake(160,5,20,20)]; 
    tblImage.image = [UIImage imageNamed:@""]; 
    [cell.contentView addSubview:tblImage]; 
} 

注:フレームは一時的です。

1

あなたは基本的にtableViewを持っています。その画像を追加したいのですが、あなたの編集中のtableViewCell

私はすでにあなたのtableViewためeditingEnabledを持っていると仮定します、そしてあなたは、テーブルセル内

- (void)setEditing:(BOOL)editing animated:(BOOL)animate 

    { 

    if (editing) { 
      // Configure self.tableView and individual cells and add the "|" as a subView. 
      // It will all be tricky, and you should be able to logically place the vertical bar 
      // But whatever you want to be in your EDIT mode, you will have to configure it here. 
    } else { 
      // Re-configure and implement the 'correct' cells back to normal tableView 
    } 

} 
0

テイクuiimageviewを実装し、あなたのtablename.cell.heightに応じて1セット高さにその幅を設定する必要があります。 。

それは間違いなくあなたのテーブルビューのcell.Justは、セルの作成時にサブビューを追加し、編集ボタンの上に隠されたそれまではクリックを入れてカスタマイズすることができ、あなたの問題

0

を解決します。

関連する問題