简体   繁体   中英

custom UIView and First Responder

In Root View controller class I have a UIButton which is hooked to some Action. when action is triggered it adds a custom UIview over the Root View Controller class.

And if user touches the root view controller view it show other abc view.

Now what I am trying to do is if user touches out side of the custom UIview when it is present, it should get removed, the touch should not open abc View, means the first touch on view controller should dismiss the customview.

what is the approach in doing that?

First of all add a subview in your rootview controller in the action of your UIButton.

Secondly set coordinates of your subview.When the user touches outside the subView it has to be removed from the View.

This can be achieved by using the TouchesEnded method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM