// 将像素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;

 
例把UITableViewCell中的subview(btn)的frame转换到 controllerA中
 

// controllerA 中有一个UITableView, UITableView里有多行UITableVieCell,cell上放有一个button

// 在controllerA中实现:

CGRect rc = [cell convertRect:cell.btn.frame toView:self.view];

CGRect rc = [self.view convertRect:cell.btn.frame fromView:cell];

// 此rc为btn在controllerA中的rect

或当已知btn时:

CGRect rc = [btn.superview convertRect:btn.frame toView:self.view];

CGRect rc = [self.view convertRect:btn.frame fromView:btn.superview];

最新文章

  1. 6*17点阵的Window程序, Java写的。
  2. 翻译:Knockout 快速上手 - 4: 你需要知道的顶级特性
  3. 哈希(2) hash索引
  4. 执行npm安装模块的命令 Cannot find module
  5. Android使用的开发MediaRecorder录制声音
  6. Google Code Jam 2016 Round 1B Problem C. Technobabble
  7. selenium在页面中多个fream的定位
  8. “基于数据仓库的广东省高速公路一张网过渡期通行数据及异常分析系统"已被《计算机时代》录用
  9. Mybatis 源码简述
  10. vue 工作学习总结
  11. 《软件性能测试与LoadRunner实战教程》喜马拉雅有声图书上线
  12. Windows Installation
  13. SQL 中的 IFNULL和NULLIF
  14. Delphi 集合和字符串互转
  15. 利用Junit实现eclipse单元测试
  16. Python文本文件的输入输出操作学习
  17. LeetCode: Rotate Image 解题报告
  18. 【BZOJ3714】Kuglarz(最小生成树)
  19. linux c下输入密码不回显
  20. 利用SQLServer查询分析器获取存储过程的返回值,检查测试存储过程

热门文章

  1. nginx知识点
  2. mybatis传入map参数parameterType
  3. 【流媒體】live555—VS2008 下live555编译、使用及测试
  4. Android:再按一次退出程序
  5. Some projects cannot be imported because they already exist in the workspace
  6. ArcGIS Runtime for Android开发教程V2.0(1)基本概念
  7. Android ImageView(纯java)
  8. Linux信号列表
  9. 关于fedora下jdk的安装
  10. 2.1 linux中uboot移植