开发者

How to transform UIView's bounds space like GL space?

开发者 https://www.devze.com 2023-03-16 04:13 出处:网络
I\'m handling UITouch event sourced from UIView. The problem is the coordinates are specified in UIView\'s bounds, left-top corner originated point space. But my GL viewport is defined in left-bottom

I'm handling UITouch event sourced from UIView. The problem is the coordinates are specified in UIView's bounds, left-top corner originated point space. But my GL viewport is defined in left-bottom originated (Y-flipped), pixel space.

I can convert all touch coordinates manually, however, if I could set custom transform on coordinate system of UIView, this will be solved automatically. Is this possible? What I want to do ultimat开发者_运维百科ely is receiving UITouch with my custom coordinate system.


Use an affine transform:

CGAffineTransform transform = CGAffineTransformMakeScale(1.0, -1.0);

view.transform = transform;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号