中心缩放的实时 iPhone 相机视图,“CGAffineTransformTranslate”不工作
我有一个小问题无法解决。我真的希望有人能帮助我。我想调整实时摄像机视图的大小并将其放置在中心,使用下面的代码:
picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, 0.5, 0.56206);
picker.cameraViewTransform = CGAffineTransformTranslate(picker.cameraViewTransform, 80, 120);
但我得到的只是屏幕左上角的缩放 1/2 大小的视图。似乎“CGAffineTransformTranslate”什么也没做。即使我使用时,翻译也不起作用:
picker.cameraViewTransform = CGAffineTransformMake(1, 0, 0, 1, 80, 120);
翻译部分似乎对实时摄像机视图没有影响。 希望有人能启发我。
谢谢。
I have a little problem which I could not solve. I really hope someone can help me with that. I wanted to resize the live camera view and place it in the center, using the following code below:
picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, 0.5, 0.56206);
picker.cameraViewTransform = CGAffineTransformTranslate(picker.cameraViewTransform, 80, 120);
But all I got was a scaled 1/2 sized view on the top left of the screen. It seems as though "CGAffineTransformTranslate" does nothing at all. The translation didn't work even when I used:
picker.cameraViewTransform = CGAffineTransformMake(1, 0, 0, 1, 80, 120);
The translation portion seems to have no effect on the live camera view.
Hope someone can enlighten me.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也在同一条船上。我所做的就是物理移动拾取器框架。
I was in the same boat. What I did was physically move the picker frame.
我一直在为同样的问题而苦苦挣扎。我已经确认缩放和旋转预览有效,但翻译似乎被忽略。我推测设置变换时 CGAffineTransform 的 tx, ty 部分将被忽略。这是 iPhone OS v3.1.2 的情况。我现在没有其他操作系统版本可供测试。
I've been banging my head against the same problem. I have confirmed that scaling and rotating the preview works, but translations appear to be ignored. I would speculate that the tx, ty portions of the CGAffineTransform are being ignored when the transform is set. This is with iPhone OS v3.1.2. I don't have other OS versions to test against right now.
我得到了解决方案。
必须在消息上设置:
示例代码:
I got solution.
It must be set on message:
Sample code: