gpt4 book ai didi

ios - 带有复选标记和详细信息披露的表格 View

转载 作者:可可西里 更新时间:2023-11-01 04:31:00 25 4
gpt4 key购买 nike

我正在制作一个带有多行选择选项的表格 View 。所以,我使用了复选标记附件类型的操作。我还需要编辑/重命名所选行中的文本。

基本上,我需要在单元格的左侧放置复选标记(复选框)并在右侧放置详细信息披露,这两个功能均有效。

下面的代码是我有的复选标记,当前复选标记出现在单元格的右侧。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.

TSIPAppDelegate *appDelegate = (TSIPAppDelegate *)[[UIApplication sharedApplication]delegate];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSString *cellText = cell.textLabel.text;
if (cell.accessoryType==UITableViewCellAccessoryNone)
{
cell.accessoryType=UITableViewCellAccessoryCheckmark;
appDelegate.selectedFile = cellText;
if (prevSP!=indexPath.row) {
cell=[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:prevSP inSection:0]];
cell.accessoryType=UITableViewCellAccessoryNone;
prevSP=indexPath.row;
}
}
else if (prevSP!=indexPath.row){
cell.accessoryType=UITableViewCellAccessoryNone;
}
}

有什么建议吗?

选中一行后,应启用/禁用复选标记并选中披露按钮,它应打开一个新 View 以编辑所选行。

最佳答案

accessoryType 类型是枚举 UITableViewCellAccessoryType,根据定义它不会接受多个值,因为它不是按位枚举。因此,您必须选择一个并通过自定义代码模仿另一个。

关于ios - 带有复选标记和详细信息披露的表格 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15037209/

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