1

我正在编写类似滑动功能的“tweetie 2”,但遇到了我希望是最后一个绊脚石。

当用户在表行上滑动时,“控件”视图如预期的那样动画,但是当行选择时,didSelectRowatIndExpath被解开。期望的结果是当“控件”视图可见时禁用didSelectRowAtIndexPath方法或缺少更好的短语...停止响应者链以继续通过“控件”视图。

uitouch 委托方法在自定义 uitablviewcell 中使用/被调用。

4

2 回答 2

2

根据需要设置/取消设置allowsSelectionin的值UITableView怎么样?

于 2009-12-21T21:54:14.253 回答
1

一点逻辑应该在这里完成工作。假设您将此属性添加到 UITableViewController 子类:

NSIndexPath *indexPathForCellInUtilityMode;

当用户触发单元格的实用程序视图时,您的单元格会执行以下操作:

NSIndexPath *cellIndexPath = [parentViewController.tableView indexPathForCell:self];
parentViewController.indexPathForCellInUtilityMode = cellIndexPath;

然后:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {


if ([indexPath compare:indexPathForCellInUtilityMode] != NSOrderedSame) {
//Do whatever you're normally doing in this method.
}

因此,您将禁用受影响单元格的选择,同时仍允许用户与其他可见单元格进行交互。

于 2009-12-22T02:18:24.530 回答