touches
//當(dāng)有一個(gè)或多個(gè)手指觸摸事件在當(dāng)前視圖或window窗體中響應(yīng)
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject]; //視圖中的所有對(duì)象
CGPoint point = [touch locationInView:self.view]; //返回觸摸點(diǎn)在視圖中的當(dāng)前坐標(biāo)
int x = point.x;
int y = point.y;
NSLog(@"touch (x, y) is (%d, %d)", x, y);
}
UITapGestureRecognizer 獲取點(diǎn)擊位置
-(void)handleSingleTap:(UITapGestureRecognizer *)sender
{
CGPoint touchPoint = [sender locationInView:self.view];
}