坐标系转换公式

在应用开发的过程中经常会遇到需要转坐标系的时候,下面推荐使用convertRect来转换坐标系,toView参数为空的时候,代表转换为window控制器
 
CGRect btnFrame = [btn convertRect:btn.bounds toView:nil];
等价于
CGRect btnFrame = [btn.subViews convertRect:btn toView:nil];
 
附:
frame:描述当前视图在其父视图中的位置和大小。 
bounds:描述当前视图在其自身坐标系统中的位置和大小。
posted on 2015-12-09 17:21  十一点前要睡觉的小寒  阅读(281)  评论(0编辑  收藏  举报