I have a custom popup menu in my iOS application. It is UIView with buttons on it. How do I handle event when user touch up outside this view? I want to hide menu at this moment.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should create a custom
UIButtonthat takes up the whole screen. Then add your subview on top of that button. Then when the user taps outside of the subview they will be tapping the button.For example, make the button like this:
(where
yourhidemethod:is the name of the method that removes your subview.) Then add your subview on top of it.Update: It looks like you’re wanting to know how to detect where touches are in a view. Here’s what you do: