Add tap gesture to UIStackView

后端 未结 3 2021
轻奢々
轻奢々 2021-02-18 21:49

Im attempting to add a UITapGesture to a UIStackView within a collectionView cell but each time I do my app crashes. (All IBOutlets are co

3条回答
  •  猫巷女王i
    2021-02-18 22:41

    Set the gesture recognizer in the main thread:

    DispatchQueue.main.async {
        self.view.gestureRecognizers = [self.tapGestureRecognizer]
    }
    

提交回复
热议问题