Coordinates of coordinates in UIView.
Coordinate Transformation in IOS -- UIView
// Convert the pixel point from the view where the point is located to the target view, and return the pixel value in the target view.
-(CGPoint) convertPoint :( CGPoint) point toView :( UIView *) view;
// Transfers the pixel point from the view to the current view and returns the pixel value in the current view.
-(CGPoint) convertPoint :( CGPoint) point fromView :( UIView *) view;
// Convert the rect view from the rect view to the target view, and return the rect in the target view.
-(CGRect) convertRect :( CGRect) rect toView :( UIView *) view;
// Switch the rect from the view to the current view, and return the rect in the current view.
-(CGRect) convertRect :( CGRect) rect fromView :( UIView *) view;
For example, convert the frame of subview (btn) in UITableViewCell to controllerA.
// There Is A UITableView in controllerA, multiple UITableVieCell lines in UITableView, and a button in cell.
// Implemented in controllerA:
CGRect rc = [cell convertRect: cell. btn. frame toView: self. view];
Or
CGRect rc = [self. view convertRect: cell. btn. frame fromView: cell];
// This rc is the rect of btn in controllerA
Or when btn is known:
CGRect rc = [btn. superview convertRect: btn. frame toView: self. view];
Or
CGRect rc = [self. view convertRect: btn. frame fromView: btn. superview];