gpt4 book ai didi

ios - UITableViewCellAccessoryCheckmark 覆盖 iOS 7 上的单元格分隔符

转载 作者:技术小花猫 更新时间:2023-10-29 11:23:45 25 4
gpt4 key购买 nike

在 iOS 7 上使用此代码会导致分隔符 View 被覆盖或缩短:

cell.accessoryType = UITableViewCellAccessoryCheckmark;

如何修复分隔符 View ?

我正在使用原型(prototype)单元,但我没有将它们子类化。

enter image description here

[编辑]

这是来自 cellForRowAtIndexPath 的相关代码:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];

if (indexPath.section == kDefaultViewSection){
NSArray *defaultViewNames = @[LQSettingsSentenceView, LQSettingsFullTextView, LQSettingsFlashcardsView];
NSString *preferredViewName = [LQSettings valueForKey:LQSettingsPreferredLessonView];
if ([defaultViewNames[indexPath.row] isEqualToString:preferredViewName]){
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
}



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (indexPath.section != kDefaultViewSection){
return;
}

// Just turn all checks off for a minute
for (int x=0; x<3; x++) {
NSIndexPath *ip = [NSIndexPath indexPathForRow:x inSection:kDefaultViewSection];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:ip];
cell.accessoryType = UITableViewCellAccessoryNone;
}

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}

最佳答案

在我的例子中,我禁用了系统提供的分隔线并在单元格的 xib 中添加了我的自定义分隔线。有时正确的复选标记覆盖了底部分隔线的一部分。我为解决这个问题所做的是我有将尾部约束更改为 cell 而不是 contentView。 [不是 super View ]

enter image description here

关于ios - UITableViewCellAccessoryCheckmark 覆盖 iOS 7 上的单元格分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21727948/

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