简体   繁体   中英

Gesture pattern recognizer in IOS.?

I am trying to implement a special login for developer without having a bit of changes in the UI. For example, suppose to log in as a developer, I made a "D" shape over the UI and it will open a Developer mode for me. How can I achieve this functionality? Is there any third party which can recognize the shape that i am trying to made or any other suggestion?

Yeah, you can do that with a subclass of UIGestureRecognizer; the tutorial I am linking shows all the tools you will need to build your own. You want to look at the Custom Gesture Recognizer part of the tutorial towards the bottom.

Basically, you will want to write a gesture that can evaluate if the user made a "D" shape over whichever view has your gesture recognizer. This can be done by keeping track of the last point, and seeing if the current point at any given time fits in the gesture. Or, you could keep track of every point the gesture has ever recorded and write a function that would evaluate if the points you've recorded qualify as a "D" in your gesture.

This may get complicated as there multiple ways to draw a D. However, you could start with two, one looking for a vertical line, followed by an backwards C. The other, a backwards C followed by a vertical line.

Here is a good tutorial: http://www.raywenderlich.com/6567/uigesturerecognizer-tutorial-in-ios-5-pinches-pans-and-more

While searching here and there I found that it would be a great idea to divide our screen in 9 area and assign each one as a digit same as mobile phone keypad. When a user pan at any location have that location co-ordinate and match it with divided region if it falls manage a array and hold that value.

That value works like a unique pin for you.

For example to check that letter is "L" check that if the order of array element is 1->4->7->8->9 or to check "U" check that if the order of array is 1->4->7->8->9->6->3 then it should be "U".

Is there any other way to recognize the character by touch on phone.

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