当覆盖drawRect时,我发现那里的坐标使用0,0作为左上角.
但是Apple UIView编程指南说:
Some iOS technologies define default coordinate systems whose origin point and orientation differ from those used by UIKit. For example,Core Graphics and OpenGL ES use a coordinate system whose origin lies in the lower-left corner of the view or window and whose y-axis points upward relative to the screen.
我糊涂了;当他们在这里引用Core Graphics时,他们是在谈论与Quartz不同的东西吗?
解决方法
本文档中的“核心图形”意味着“Quartz”,是的.这只是过于简单化了.
当您自己创建CGContext时,其坐标系的原点位于左下角.当UIKit创建用于绘制视图的CGContext时,它会在调用-drawRect:之前有助于翻转坐标系.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。