convertRect
2018-04-24 本文已影响0人
李十岁
1、// 将像素point由point所在视图转换到目标视图view中,返回在目标视图view中的像素值-(CGPoint)convertPoint:(CGPoint)point toView:(UIView*)view;
举例:[A convertPoint:point toView:B]; 则A上的point点转换成B上相对的点
2、// 将像素point从view中转换到当前视图中,返回在当前视图中的像素值-(CGPoint)convertPoint:(CGPoint)point fromView:(UIView*)view;
[A convertPoint:point toView:B]; 则将B上point的点转换成相对于A上的点
同理:
// 将rect由rect所在视图转换到目标视图view中,返回在目标视图view中的rect-(CGRect)convertRect:(CGRect)rect toView:(UIView*)view;
// 将rect从view中转换到当前视图中,返回在当前视图中的rect-(CGRect)convertRect:(CGRect)rect fromView:(UIView*)view;