- (CGPoint)convertPoint:(CGPoint)point toView:(nullable UIView *)view;
- (CGPoint)convertPoint:(CGPoint)point fromView:(nullable UIView *)view;
- (CGRect)convertRect:(CGRect)rect toView:(nullable UIView *)view;
- (CGRect)convertRect:(CGRect)rect fromView:(nullable UIView *)view;
对于convertRect的参数具体可以归纳为:源、被操作对象、目标对象;(本质就是计算源上的被操作对象,相对于目标的frame)
fromView后面跟的参数:源
toView后面的参数是:目标
converRect后面跟的参数永远是被操作的对象;
例如:
[viewA convertRect:viewC.frame toView:viewB] ; 分析:viewB为目标对象,viewC是操作对象,那么源就是viewA(计算viewA上的viewC,相对于viewB的frame)
[viewA convertRect:viewC fromView:viewB];分析: viewB为源对象,viewC是被操作对象,那么目标对象就是viewA(计算viewBC上的viewC,相对于ViewA的frame)