我如何为在 xcode 中开发的 iPhone 应用程序制作自定义应用内相机?

发布于 2024-12-05 03:12:57 字数 723 浏览 1 评论 0原文

我正在制作一个 iPhone 摄影应用程序,在应用程序启动后,屏幕会显示一个大图像,其中相机通过图片中的一个孔显示在中心 - 这应该与 hipstamatic 的外观类似。由于相机在启动时会打开,因此我还需要一个按钮来拍照(但这不是目前的优先事项)。我想知道是否有一种简单的方法可以完成我所描述的操作?到目前为止,研究表明我倾向于使用 uiimagepickercontroller,但仅使用它并没有给我带来我想要的定制量 - 或者我错了,我可以按照我所描述的使用 uiimagepickercontroller 进行操作?

现在,这是我用于相机的代码 - 它当前是一个链接到按钮的 ibaction,单击后即可启动相机。然而,正如我所提到的,我希望相机在打开应用程序时自行打开

    self.picker = [[UIImagePickerController alloc] init];
self.picker.allowsEditing = NO;
[self.picker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentModalViewController:self.picker animated:NO];
[picker release];

,此代码不仅导航远离当前视图,而且具有所有控件(缩放、点击对焦等),已满屏幕,并播放镜头打开的愚蠢动画。

如果您能提供任何信息,我们将不胜感激。 预先非常感谢

扎克

i am making a photography iphone app and am after, upon the app being launched, the screen to be a large image where the camera is shown in the center through a hole in the picture - this should be a similar look to that of hipstamatic. since the camera would be open upon launch, i would also need a button to take the picture (but that is not a priority at the moment). i am wondering whether there is an easy way to do what i have described? so far, research has pointed me towards using the uiimagepickercontroller, but using just this did not give me nearly the amount of customization i am after - or am i mistaken and i can do as i described using the uiimagepickercontroller?

right now, this is the code i'm using for the camera - it's currently an ibaction linked to a button that launches the camera once clicked. however, as i mentioned, i would like the camera to open on its own upon opening the app

    self.picker = [[UIImagePickerController alloc] init];
self.picker.allowsEditing = NO;
[self.picker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentModalViewController:self.picker animated:NO];
[picker release];

this code not only navigates away from the current view, but it has all the controls (zoom, tap to focus, etc.), is full screen, and plays that silly animation of the lens opening.

anything you have to offer would be greatly appreciated.
many thanks in advance

zach

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

近箐 2024-12-12 03:12:57

使用 showsCameraControls< UIImagePickerController 的 code>cameraOverlayView 属性,用于在选择器上方添加自定义叠加层(使用具有透明背景的视图,在其中添加一些元素作为子视图来覆盖/框架/遮罩选择器的某些部分(如果需要)。

您甚至可以使用 cameraViewTransform 更改正在捕获相机图像的相机视图的大小和位置(即变换)。

Use the showsCameraControls and cameraOverlayView properties of UIImagePickerController to add custom overlay above the picker (using a view with a transparent background in which you add some elements as subviews to overlay / frame / mask some parts of the picker if needed.)

You can even use the cameraViewTransform to change the size and position (i.e. the transform) of the camera view that is capturing the camera image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文