UIImagePickerController.cameraViewTransform 忽略翻译
我的应用程序在 iOS 4.3 上无法正常工作。它为 UIImagePickerController 使用自定义相机视图叠加层。由于相机和屏幕的宽高比差异,实时取景默认在底部有一个黑条。为了摆脱它,我曾经应用两个变换,将视图向下移动并将其缩放到全屏:
self.cameraFeed = [[UIImagePickerController alloc] init];
CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 25.0);
self.cameraFeed.cameraViewTransform = CGAffineTransformScale(translate, 480.0/430.0, 480.0/430.0);
在当前的 iOS 版本中,平移变换似乎没有做任何事情 - 我在底部有一个 25px 的黑条,更改值没有任何影响。然而,缩放和旋转变换按预期工作。
有人有类似的问题吗?
My app stopped working correctly with iOS 4.3. It uses a custom camera view overlay for the UIImagePickerController. Because of the aspect ratio differences between camera and screen live view by default has a black bar at the bottom. To get rid of it I used to apply two transforms which shift the view down and scales it to full screen:
self.cameraFeed = [[UIImagePickerController alloc] init];
CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 25.0);
self.cameraFeed.cameraViewTransform = CGAffineTransformScale(translate, 480.0/430.0, 480.0/430.0);
With the current iOS version it seems that the translation transform doesn't do anything - I have a 25px black bar at the bottom and changing the values doesn't have any effect. However scale and rotate transforms work as expected.
Anyone has any similar problems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用视频预览层(如果没记错的话,自 4.2 起可用)而不是 UIImagePicker。有了它,您可以根据需要完全自定义您的 UI。
You should use the video preview layer (available since 4.2 if memory serves) instead of UIImagePicker. With it you can fully customize your UI as you see fit.