viewcontroller 新建一个scrollview 鼠标点击scrollview 获取鼠标点击scrollview上的坐标,坐标是相对scrollview的坐标
viewcontroller 新建一个scrollview 鼠标点击scrollview 获取鼠标点击scrollview上的坐标,坐标是相对scrollview的坐标
这是什么平台?ios吗?
ios的话,被点击view重写touchesBegan:withEvent:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event if (touches.count == 1)//单指操作 { UITouch *touch = touches.anyObject; CGPoint touchLocation = [touch locationInView:self.window]; NSLog(@"%@",NSStringFromCGPoint(touchLocation)); }
2 回答1.1k 阅读
1 回答996 阅读✓ 已解决
1 回答2.7k 阅读
1 回答1.4k 阅读
1.7k 阅读
1 回答1.1k 阅读
1.3k 阅读
MyScrollView.h
MyScrollView.m
MyViewController.m
然后看输出: