坐标系转换 iOS

来源:互联网 发布:mac自带放大镜快捷键 编辑:程序博客网 时间:2024/04/30 03:14
以下两种方式 等价CGRect newFrame = [view convertRect:view.bounds toView:window]; // bounds 是相对于自身
CGRect newFrame = [view.superview convertRect:view.frame fromView:window]; // frame 是相对于父视图

<pre name="code" class="objc">CGRect newFrame = [参数一 convertRect:参数二 toView:参数三];
其中:参数一是原始坐标系,参数二相对原始坐标系的CGRect ,参数三是新坐标系,参数三为nil 是相对于window

1 0
原创粉丝点击