1Click-UITapGestureRecognizer
override func viewdidload () { super.viewdidload () let rect=cgrect (x:80,y:200,width:200,height:200); var view1 = uiview (Frame: rect) view1.backgroundcolor = uicolor.redcolor () self.view.addsubview (View1)          //1, creating gesture recognizers var gesture = uitapgesturerecognizer (target: self, action: "viewAction:") # warning If you want the recognizer to recognize a variety of touches, such as 1 points and 2 points, build 2 uitapgesturerecognizer gesture.numberoftapsrequired = 2 //clicks // gesture.numberoftouchesrequired = 2 //Multi-Touch         //2, associating recognizers to views View1.addgesturerecognizer (gesture) }     //3, gesture-referenced action func viewaction (Sender:uitapgesturerecognizer) { //Gets the location at the click var point:cgpoint = sender.locationinview (Self.view) println ("\ (point)") println ("clicked") }
2,Zoom in and zoom Uipinchgesturerecognizer
override func viewdidload () { super.viewdidload ()   //1, creating gesture recognizers var gesture = Uipinchgesturerecognizer (target: self, action: "viewaction:")            //2, associating recognizers to views view1.addgesturerecognizer (gesture)    }    //3, gesture-referenced action func viewaction (sender: UITapGestureRecognizer) { var _height = view1.bounds.height Var _width = view1.bounds.width View1.bounds.size = cgsize (width: _width * sender.scale, Height: _height * sender.scale) }
iOS multi-touch and gesture recognition