IOS touch tracking code
问题 I'm making an app for iPhone in Xcode, and It requires a box to follow my finger only on the X axis. I couldn't find any solution online to this, and my coding knowledge isn't that great. I've been trying to use touchesBegan and touchesMoved . Could someone please write me up some code please? 回答1: First you need the UIGestureRecognizerDelegate on your ViewController.h file: @interface ViewController : UIViewController <UIGestureRecognizerDelegate> @end Then you declare an UIImageView on your