0

我有一个带有自定义 UITableViewCells 的 UITableView,大多数时候当它们被触摸时,didSelectRowAtIndexPath: 被调用,并推送了一个新视图。然而,有时当他们以某种方式被点击时(点击并按住大约一秒钟),他们将保持突出显示并且不会推动下一个视图,直到在屏幕上的其他任何地方检测到另一个点击。我尝试在 didSelectRowAtIndexPath: 中记录一条消息:并确认在这些情况下没有调用它。该方法中的代码是:

PortfolioVC *portfolioController = [self.storyboard instantiateViewControllerWithIdentifier:@"portfolioIdentifier"];
AccountInformationVC *accountController = [self.storyboard instantiateViewControllerWithIdentifier:@"accountIdentifier"];
[[Globals Variables] setIndex:indexPath.row];

if (indexPath.section == 0)
    [self.navigationController pushViewController:accountController animated:YES];
if (indexPath.section == 1)
    [self.navigationController pushViewController:portfolioController animated:YES];

通过将 selectedBackground 连接到包含突出显示的图像的 UIImageView,在自定义 UITableViewCell 的 xib 中设置突出显示的图像。

4

1 回答 1

0

我解决了这个问题。我不得不重新连接自定义单元 xibs 中的背景 UIImageViews。之后,清理构建并删除应用程序,问题得到解决。我还尝试覆盖自定义 UITableViewCells 中的 setSelected 和 setHighlighted 方法,并删除了这些方法。

于 2012-06-14T17:34:49.013 回答