iOS中locationInView:和translationInView:的区别究竟有何本质差异?

2026-04-02 12:050阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计151个文字,预计阅读时间需要1分钟。

iOS中locationInView:和translationInView:的区别究竟有何本质差异?

locationInView:获取的是手指点击屏幕实时位置的坐标点translationInView:获取的是手指移动后,在相对坐标中的位置点locationInView:获取的是手指点击屏幕实时位置的坐标点translationInView:获取的是手指移动后,在相对坐标中的位置点

locationInView:获取到的是手指点击屏幕实时的坐标点translationInView获取到的是手指移动后在相对坐标中 locationInView:获取到的是手指点击屏幕实时的坐标点

translationInView获取到的是手指移动后在相对坐标中的偏移量

iOS中locationInView:和translationInView:的区别究竟有何本质差异?

例如CGPoint  translation [panGesture translationInView:self.imageView];

translation.x 就是相对self.imageView.frame.origion.x的偏移量

本文共计151个文字,预计阅读时间需要1分钟。

iOS中locationInView:和translationInView:的区别究竟有何本质差异?

locationInView:获取的是手指点击屏幕实时位置的坐标点translationInView:获取的是手指移动后,在相对坐标中的位置点locationInView:获取的是手指点击屏幕实时位置的坐标点translationInView:获取的是手指移动后,在相对坐标中的位置点

locationInView:获取到的是手指点击屏幕实时的坐标点translationInView获取到的是手指移动后在相对坐标中 locationInView:获取到的是手指点击屏幕实时的坐标点

translationInView获取到的是手指移动后在相对坐标中的偏移量

iOS中locationInView:和translationInView:的区别究竟有何本质差异?

例如CGPoint  translation [panGesture translationInView:self.imageView];

translation.x 就是相对self.imageView.frame.origion.x的偏移量