本文目录
(图片来源网络,侵删)
切换坐标系的方法有哪两种?
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];
>印出:X *** Log(@"%@",NSStringFromCGRect(frame1));
>>2、反过来也是一样的【一般就别反,反毛啊,直接用不就行了】
>和上面的其实也是同一个表现方式:view1在view2中的位置
>CGRect *frame3 = [self.view2 convertRect:self.view1.bounds fromView:self.view1]
还没有评论,来说两句吧...