当前View的坐标相对其他View的位置坐标

 

 

// 将rect由rect所在视图转换到目标视图view中,返回在目标视图view中的rect
- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view;
// 将rect从view中转换到当前视图中,返回在当前视图中的rect
- (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view;

 

例子:

//转换的相对位置weakCell  相对于父控件的位置坐标
CGRect weakCellFrame = [weakCell convertRect:weakCell.bounds toView:weakSelf.parentController.view];

 

posted @ 2017-05-10 14:15  宁静暖风  阅读(534)  评论(0编辑  收藏  举报