iOS开发--点击屏幕获得屏幕坐标

来源:互联网 发布:海尔ife矩阵 编辑:程序博客网 时间:2024/04/28 19:24

添加触摸事件,即可在xcode中打印出当前鼠标点击的模拟器中的点的坐标:


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

{

    UITouch *touch = [touches anyObject];

    

    [touch locationInView:self];

    NSLog(@"%@",touch);

}

0 0
原创粉丝点击