【问题标题】:Custom UITableViewCells occasionally remain highlighted and do not push next view自定义 UITableViewCells 偶尔会保持突出显示并且不推送下一个视图
【发布时间】:2012-06-14 15:56:00
【问题描述】:

我有一个带有自定义 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 中设置突出显示的图像。

【问题讨论】:

    标签: iphone objective-c ios5 uitableview


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-22
      • 2021-04-01
      • 2010-11-15
      • 2011-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-28
      相关资源
      最近更新 更多