Is there a method/class to detect if the finger leaves the screen when sliding out the screen on one of the sides ?
Thx.
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 can try using touchesEnded to detect where the finger was when the touch ended. If it is at the edge of the screen side, it can be inferred that the user has left the screen.
So on an iPhone, if it is the left or right side, it would have an x coordinate of 0 or 320, and if it was the top and bottom side, it would have a y coordinate of 0 or 480.
On an iPad it would be 0 and 768, and 0 and 1024 respectively.
You can start with touchesBegan and detect which direction they were coming from to decide in which direction to slide the screen.
touchesBegan and touchesEnded are methods of the UIResponder class, so it should be freely available to use anywhere.