1、在坐标系的转换中,这下面两种方式是等价一样

  对应的意思就是说:我们的view1的从以原来的坐标系转化为以view2的原点为坐标系[心的frame就是以两个坐标系的点的值差]

CGRect *frame1 = [self.view1 convertRect:self.view1.bounds toView:self.view2];

CGRect *frame2 = [self.view1.superView  convertRect:self.view1.frame toView:self.view2];

打印出:XBLog(@"%@",NSStringFromCGRect(frame1));

 

2、反过来也是一样的【一般就别反,反毛啊,直接用不就行了】

  和上面的其实也是同一个表现方式:view1在view2中的位置

CGRect *frame3 = [self.view2 convertRect:self.view1.bounds fromView:self.view1]

 

相关文章:

  • 2021-12-13
  • 2021-06-16
  • 2021-06-30
  • 2021-12-21
  • 2021-05-26
  • 2021-07-28
  • 2022-12-23
猜你喜欢
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2021-12-03
  • 2021-11-14
  • 2021-07-17
相关资源
相似解决方案