2021年1月6日星期三

Dismiss UIView within ViewController by tapping outside of UIView

I'm presenting a UIView over my ViewController which contains a table view that covers the whole view controller. I want to dismiss the UIView when tapping outside of the UIView, but have not found anything that helps the cause. This is what I'm trying to do, and it should work but it's not registering touches even if the UIView is not presented. Anyone dealt with a similar issue?

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {          let touch: UITouch? = touches.first            if touch?.view != fullSessionView {              fullSessionView?.removeFromSuperview()          }      }  
https://stackoverflow.com/questions/65556826/dismiss-uiview-within-viewcontroller-by-tapping-outside-of-uiview January 04, 2021 at 10:01AM

没有评论:

发表评论