私はテーブルビューの編集時にチェックマークと移動の間の線をどのように表示するのかという問題があります。下の画像と同様です。テーブルビューの編集時に行を表示する方法は?
は、プロセスを説明したり、他の可能な場合のコード例を私に送ってください。
ありがとうございます。
私はテーブルビューの編集時にチェックマークと移動の間の線をどのように表示するのかという問題があります。下の画像と同様です。テーブルビューの編集時に行を表示する方法は?
は、プロセスを説明したり、他の可能な場合のコード例を私に送ってください。
ありがとうございます。
幅が1ピクセル、背景色が灰色のUIViewを作成し、これをチェックマークの右側に追加すると問題ありません。
編集オプションがイメージの場合、次のようなコードを使って行を表示できます。
ステップ
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
は、あなたが欲しいの正確な取得願っています:)これで
ルック:!
宣言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];
}
注:フレームは一時的です。
あなたは基本的に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
}
}
テイクuiimageviewを実装し、あなたのtablename.cell.heightに応じて1セット高さにその幅を設定する必要があります。 。
それは間違いなくあなたのテーブルビューのcell.Justは、セルの作成時にサブビューを追加し、編集ボタンの上に隠されたそれまではクリックを入れてカスタマイズすることができ、あなたの問題
を解決します。