View some methods
#import "HMView.h"@implementationHmview//a complete touch process//Touchesbegan, touchesmoved, touchesended/*Nsarray set ordered Nsset disorder*///Touch Start- (void) Touchesbegan: (Nsset *) touches withevent: (Uievent *)Event{ //get a UitouchUitouch *touch =[touches anyobject]; //NSLog (@ "%s----%d", __func__,touches.count);//NSLog (@ "%d", touch.tapcount);//NSLog (@ "%d", touch.phase);}//Finger Movement- (void) touchesmoved: (Nsset *) touches withevent: (Uievent *)Event{ //get a UitouchUitouch *touch =[touches anyobject]; //get the current locationCgpoint current =[Touch locationinview:self]; //Get previous pointCgpoint pre =[Touch previouslocationinview:self]; //x-axis offsetCGFloat OffsetX = current.x-pre.x; CGFloat OffsetY= Current.y-pre.y; NSLog (@"%@", Nsstringfromcgpoint (current)); //get the center of a viewCgpoint Center =Self.center; Center.x+=OffsetX; Center.y+=OffsetY; Self.center=Center;}//Touch End- (void) touchesended: (Nsset *) touches withevent: (Uievent *)Event{ //get a UitouchUitouch *touch =[touches anyobject];//NSLog (@ "%d", touch.phase);//NSLog (@ "%s----%p", __func__,touch);}//The touch was interrupted, like calling.- (void) touchescancelled: (Nsset *) touches withevent: (Uievent *)Event{ }@end
iOS 15th day (1, drag-and-drop of event-handling view)