gpt4 book ai didi

iphone - 表格 View 单元格 附件类型 自定义位置的复选标记

转载 作者:行者123 更新时间:2023-11-29 03:38:58 25 4
gpt4 key购买 nike

这是我的代码,

UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"Cell"];
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];

if ([cell.textLabel.text isEqualToString:@"Small" ]) {
cell.imageView.image=nil;
cell.accessoryView = nil;
cell.accessoryType=UITableViewCellAccessoryCheckmark;
return cell;
}

但是复选标记正在添加到单元格的右上角我想将其添加到单元格内的另一个位置,如下所示,

[[chkmrk alloc]initWithFrame:CGRectMake(200, -4, 100, 50)];

最佳答案

试试下面的代码。实际上 accessory View 是单元格中的按钮。创建一个自定义单元格,并在该单元格内将 AccessoryView 布局放置在 -layoutSubviews 方法中的 CustomCell.m 文件中。代码如下:

- (void) layoutSubviews
{
[super layoutSubviews];

UIView * arrowView = nil;
for (UIView* subview in self.subviews)
{
if ([subview isKindOfClass: [UIButton class]])
{
arrowView = subview;
break;
}
}
CGRect arrowViewFrame = arrowView.frame;
arrowViewFrame = CGRectMake(200, -4, 100, 50);
arrowView.frame = arrowViewFrame;
}

这将帮助您确定。

关于iphone - 表格 View 单元格 附件类型 自定义位置的复选标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18736630/

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