【问题标题】:UITableView inside childviewcontroller not receiving all tapschildviewcontroller 中的 UITableView 没有收到所有的点击
【发布时间】:2016-07-30 01:17:59
【问题描述】:

我有一个显示 UISearchController 搜索结果的 UITableview。它们位于 Childviewcontroller 内部。 我将文本写在父视图控制器的文本字段上,并将文本传递给子视图控制器的搜索栏。

这一切都很好。

但由于某种原因,当我在子视图控制器的 tableview 中选择结果时,它的响应速度不是很好。

在文本字段中输入搜索文本后(将文本字段作为 firstResponder),大多数时候我必须多次点击才能选择一行。

(P.S. userInteraction 已启用,否则将无法进行任何触摸。)

知道为什么吗?

【问题讨论】:

    标签: ios uitableview uicontainerview first-responder childviewcontroller


    【解决方案1】:

    我也有同样的问题,我的解决方法是:

    - (void) displayContentController: (UIViewController*) content{
    [content.view setFrame:recorderView.bounds];
    UINavigationController *childNavController = [[UINavigationController alloc] initWithRootViewController:content];
    childNavController.toolbarHidden = NO; // if you show toolbar
    childNavController.view.frame = content.view.frame;
    [self addChildViewController:childNavController];
    [recorderView addSubview:childNavController.view];
    [childNavController didMoveToParentViewController:self];
    }
    

    content 是我的subViewController

    【讨论】:

      【解决方案2】:

      这是针对 Swift 还是针对 Objective-C 的?您是否还在您希望被触摸的视图上放置了UI Tap Gesture Recognizer

      【讨论】:

      • Objective-C。我没有在此处添加任何点击手势,因为在子 vc 的视图上启用了用户交互,并且默认情况下其中的 tableview 已经识别触摸
      • 我不知道为什么它会在某些水龙头上工作,但不是全部。我会使用 UI Tap Gesture Recognizer 来确保它不仅仅是 ViewControllers 的问题。
      猜你喜欢
      • 1970-01-01
      • 2014-03-07
      • 1970-01-01
      • 2014-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多