开发者

Can i create custom touch events for iPhone

开发者 https://www.devze.com 2022-12-25 14:00 出处:网络
Can i create custom touch events for iPhone?? will the device support for creating 开发者_开发问答my own touch event handling ?Take a look at the UIResponder class:

Can i create custom touch events for iPhone?? will the device support for creating 开发者_开发问答my own touch event handling ?


Take a look at the UIResponder class: http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html

You will probably want to implement the touchesBegan:withEvent:, touchesEnded:withEvent: and touchesCancelled:withEvent: methods. These will all be called with an NSSet of UITouches that you can do whatever you want with.


As of the 3.2 SDK there are UIGestureRecognizer classess. They do not play well with the older UIResponder calls, but if you can do 3.2 only they are easier to get going.

There are a number of handy subclasses, such as UIRotationGestureRecognizer for handling rotation.

If you are extending Apple classes like UIScrollView you must use gesture recognizers with 3.2 and later because when a gesture recognizer cancels it will cancel your UIResponder call tracking as well. If you are handling all the gesture tracking this is not an issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消