UITouch
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
/*获取当前点击点坐标
//获取对象
UITouch * touch = [touches anyObject];
//获取手指对象所点击的坐标 ,获取位置坐标相对于..
_beginPoint = [touch locationInView:self];
//点击坐标
NSLog(@"%f", _beginPoint.x);
NSLog(@"%f", _beginPoint.y);
self.layer.shadowOpacity = 0;
NSLog(@"%s", __func__);
*/
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
self.layer.shadowOpacity = 0;
//target调用属于它的方法selector,并将self当成参数传递给selector
[self.target performSelector:self.selector withObject:self];
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
/*移动视图本身
UITouch * touch = [touches anyObject];
CGPoint point = [touch locationInView:self.window];
self.frame = CGRectMake(point.x- _beginPoint.x, point.y- _beginPoint.y, self.frame.size.width, self.frame.size.height);
self.layer.shadowOpacity = 1;
NSLog(@"%f", point.x);
NSLog(@"%f", point.y);
*/
}
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{}