首页 > 解决方案 > swift4 UISwipeGestureRecognizer Viewcontroller 带有大标题和单元格不起作用

问题描述

我有一个ViewController大标题。在我ViewController的是 2 个单元格。UISwipeGestureRecognizer向下滑动不起作用。我想searchController在 titleView 中使用此滑动操作调用 a。原因可能是大标题吗?(向下滑动标题会下降并变得更大,没关系)。但是我的滑动动作将不会被识别。有任何想法吗?

在此处输入图像描述

我的代码: -viewDidLoad()在 ViewController中调用的函数

    func swipeSetup() {

    let swipeDown = UISwipeGestureRecognizer(target: self, action: #selector(funcSwipedDown(sender:)))
    swipeDown.direction = .down

    self.view.addGestureRecognizer(swipeDown)

}

@objc func funcSwipedDown(sender: UISwipeGestureRecognizer){

    Utils.displayAlert(title: "Info", message: "swipe down")

    self.addNavigationbar() // func for adding search bar
}

标签: swift4celluisearchbaruiswipegesturerecognizerlarge-title

解决方案


推荐阅读