테이블 뷰 편집시 확인 표시와 이동 사이에 선을 표시하는 방법에 문제가 있습니다. 아래 이미지와 같습니다. 테이블 뷰 편집시 줄을 표시하는 방법은 무엇입니까?
과정을 설명하거나 다른 가능한 예제 코드에 저를 보내 주시기 바랍니다.미리 감사드립니다.
테이블 뷰 편집시 확인 표시와 이동 사이에 선을 표시하는 방법에 문제가 있습니다. 아래 이미지와 같습니다. 테이블 뷰 편집시 줄을 표시하는 방법은 무엇입니까?
과정을 설명하거나 다른 가능한 예제 코드에 저를 보내 주시기 바랍니다.미리 감사드립니다.
폭이 1px이고 배경색이 회색 인 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 세트 높이에 너비를 설정해야합니다 .
확실히 당신은 당신의 tableview의 cell.Just 셀 작성시 파단을 추가하고 편집 버튼에 숨겨진 전까지 클릭을 넣어 사용자 정의 할 수 있습니다 문제
를 해결합니다.