gpt4 book ai didi

iphone - 如何在tableview编辑时显示该行?

转载 作者:行者123 更新时间:2023-12-03 20:28:09 25 4
gpt4 key购买 nike

我有一个问题,如何在表格 View 编辑时显示复选标记和移动之间的线。如下图所示。

enter image description here

解释一下这个过程,或者如果可能的话请给我发送示例代码。

提前致谢。

最佳答案

看看这个:

声明 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];
}

注意:框架是临时的。

关于iphone - 如何在tableview编辑时显示该行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9733139/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com