// 需要获取的对象为view,则该视图相对屏幕的位置可使用下面方法实现:
UIWindow * window=[[[UIApplicationsharedApplication] delegate] window];
CGRect rect=[view convertRect: view.bounds toView:window];
CGRect rectInCollectionView = [collectionViewconvertRect:cell.frametoView:collectionView];
CGRect rect = [collectionViewconvertRect:rectInCollectionViewtoView:[collectionView superview]];
// 需要获取的对象为 UITableViewCell 则该视图相对屏幕的位置可使用下面方法实现:.
CGRect rectInTableView = [tableView rectForRowAtIndexPath:indexPath];
CGRect rectInSuperView = [tableView convertRect:rectInTableView toView:[tableView superview]];
// 将像素point由point所在视图转换到目标视图view中,返回在目标视图view中的像素值
- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;
// 将像素point从view中转换到当前视图中,返回在当前视图中的像素值
- (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view;
// 将rect由rect所在视图转换到目标视图view中,返回在目标视图view中的rect
- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view;
// 将rect从view中转换到当前视图中,返回在当前视图中的rect
- (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view;