https://github.com/CEWendel/SWTableViewCell
我希望当我单击(不拖动)表格单元格时,SWTableViewCell的RightUtilityButton将直接显示。
SWTableViewCell似乎不提供此接口
最佳答案
调用showRightUtilityButtonsAnimated:
方法。我正在使用给出的示例代码。替换didSelectRowAtIndexPath
并将UMTableViewCell
更改为YourCellClassName
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"cell selected at index path %ld:%ld", (long)indexPath.section, (long)indexPath.row);
NSLog(@"selected cell index path is %@", [self.tableView indexPathForSelectedRow]);
if (!tableView.isEditing) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
//if you want to hide other cell which are opened first
for (UMTableViewCell *cell in [tableView visibleCells]) {
[cell hideUtilityButtonsAnimated:YES];
}
UMTableViewCell *cell = (UMTableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
[cell showRightUtilityButtonsAnimated:YES];
}