转换坐标系的两种方式

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]

 

posted @ 2015-06-16 19:51  daomul  阅读(1379)  评论(0编辑  收藏  举报