同时平移、旋转和重新定义 UIView 的原点
我正在 UIView 中制作游戏。我正在尝试模拟启用指南针自动地图方向时 iOS 地图应用程序的工作方式。 我有一个 UIView,我正在尝试更改地图的 X 和Y 坐标、角度和中心点(原点)。 但我在思考如何去做时遇到了一些困难。 这是我正在尝试使用的: (此代码位于游戏循环内)
//move map
CGRect oldFrame = mapView.frame;
oldFrame.origin.y += 1;
mapView.frame = oldFrame;
//rotate map
mapView.transform = CGAffineTransformMakeRotation(mapAngle);
那么,有人有什么建议吗?
谢谢。
I'm making a game in UIView. I'm trying to simulate the way the iOS Maps app works, when the compass auto-map-orientation is enabled.
I have a UIView, and I'm trying to change the map's X & Y co-ordinates, its angle, and its center point (origin).
But I'm having some trouble getting my head around how to do it.
Here's what I'm trying to use:
(this code is inside a game loop)
//move map
CGRect oldFrame = mapView.frame;
oldFrame.origin.y += 1;
mapView.frame = oldFrame;
//rotate map
mapView.transform = CGAffineTransformMakeRotation(mapAngle);
So, does anyone have any suggestions?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论