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