【发布时间】:2013-02-23 04:54:53
【问题描述】:
我正在制作一个带有多行选择选项的表格视图。因此,我使用了复选标记附件类型操作。我还需要编辑/重命名所选行中的文本。
基本上,我需要在单元格的左侧打上复选标记(复选框),在右侧的单元格打上细节披露,两者都是功能性的。
下面的代码是我有的复选标记,目前复选标记出现在单元格的右侧。
- (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;
}
}
有什么建议吗?
When a row selected, checkmark should be enabled/disabled AND disclosure button selected, it should open a new view for editing the selected row.
【问题讨论】:
-
您能附上您的代码吗?这将使其他人更好地了解您目前拥有的东西。
-
@Jesse:我已经添加了代码。请检查。详情披露,待写。
-
@Arun 更好的方法是代替 UITableViewCellAccessoryCheckmark,您可以添加一个 UIImagview,它在每个单元格的开头和附件类型作为每个单元格的末尾都有复选标记图像
标签: ios tableview checkmark disclosure