I have a UIView which displays a warning to the user and appears at the top of my UIViewController. I'd like the user to be able to dismiss this warning by swiping it up/left/right. How can I achieve that without using a third-party library?
Everything I've found so far searching is related to making a UIViewController dismissible. I don't see a point in creating a separate ViewController off this little view.
答案 0 :(得分:0)
您可以添加平移手势识别器,也可以仅添加滑动手势识别器即可实现此目的。 让gestureRecognizer = UISwipeGestureRecognizer(.....) view.addGestureRecognizer(gestureRecognizer)