Case: Draw paths and clear paths based on multi-touch images.
Gets the coordinates of the main coordinate set ImageView.
The view does not support multi-touch by default: set to support multitouch:[Self. View setmultipletouchenabled:YES];
1. Looping Create ImageView
4- (void) touchesmoved: (Nsset *) touches withevent: (Uievent *)Event5 {6Nsinteger i =0;7 for(Uitouch *touchinchtouches) {8Uiimageview *imageview =[[Uiimageview Alloc]initwithimage:self.imagedata[i]];9Cgpoint location =[Touch LocationInView:self.view];Ten [ImageView setcenter:location]; One [Self.view Addsubview:imageview]; Ai++; - } -}
2. Clear Self.view
Iskindofclass: to determine what type of control it is.
1 [ImageView setcenter:location];2 [Self.view Addsubview:imageview];3i++;4 }5 }6 7- (void) ClearView8 {9 for(Uiimageview *imageviewinchself.view.subviews) {Ten One if([ImageView Iskindofclass:[uiimageviewclass]]) { A[UIView animatewithduration:5.0fanimations:^{ -[ImageView Setalpha:0.1f]; -} completion:^(BOOL finished) { the [ImageView Removefromsuperview]; - }] ; - } - } +}
iOS Multi-Touch traversal