- [OBJC]View Plaincopy
- Converts pixel point from view to target view, returns the pixel value in the target view
- -(Cgpoint) Convertpoint: (cgpoint) point toview: (UIView *) view;
- Converts a pixel point from view to the current view, returning the pixel value in the current view
- -(Cgpoint) Convertpoint: (cgpoint) point fromview: (UIView *) view;
- Converts a rect from the view of a rect to the target view, returning the RECT in the target view
- -(CGRect) Convertrect: (cgrect) Rect toview: (UIView *) view;
- Converts a rect from view to the current view, returning a rect in the current view
- -(CGRect) Convertrect: (cgrect) Rect fromview: (UIView *) view;
Example converts a frame of subview (BTN) in UITableViewCell to Controllera
[OBJC]View Plaincopy
- There is a uitableview in the Controllera, there is a button on Uitableviecell,cell in UITableView.
- 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 a rect of btn in Controllera
- Or when known btn:
- CGRect rc = [btn. Superview convertrect:btn. Frame Toview:self. view];
- Or
- CGRect rc = [self. View convertrect:btn. Frame fromview:btn. Superview];
Coordinate transformation in IOS development note--uiview