gpt4 book ai didi

ios - 如何一次只为一个单元格显示 UITableViewCell 的 accessoryType 属性?

转载 作者:行者123 更新时间:2023-11-28 18:57:58 25 4
gpt4 key购买 nike

我有一个 TableView ,我只想在选定的单元格中显示复选标记 accessoryType,但现在我所拥有的是选定的每个单元格的复选标记...有人可以帮我解决这个方法?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString * key = [self.settingsArray objectAtIndex:indexPath.row];
NSString * key2 = [self.soundsArray objectAtIndex:indexPath.row];

if (tableView.tag != 313) {
if([key isEqual:@"Reminder Sound"]){
[self reminderSoundPressed];
} else if([key isEqual:@"Sound"]){

}
}

UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];

//setting the reminder
if (tableView.tag == 313) {

if ([key2 isEqual:@"Sound 1"]) {
[self.delegate setReminderSound:@"reminderSound1.wav"];
newCell.accessoryType = UITableViewCellAccessoryCheckmark;

}else if ([key2 isEqual:@"Sound 2"]) {
[self.delegate setReminderSound:@"reminderSound2.wav"];
newCell.accessoryType = UITableViewCellAccessoryCheckmark;

}else if ([key2 isEqual:@"Sound 3"]) {
[self.delegate setReminderSound:@"reminderSound3.wav"];
newCell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
}

谢谢!!

最佳答案

当用户选择一行并将附件类型设置为 checkmark 时,您必须遍历并将每个其他单元格的附件类型更改为 none

关于ios - 如何一次只为一个单元格显示 UITableViewCell 的 accessoryType 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30157081/

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