我如何为在 xcode 中开发的 iPhone 应用程序制作自定义应用内相机?
我正在制作一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
showsCameraControls
和 <UIImagePickerController
的 code>cameraOverlayView 属性,用于在选择器上方添加自定义叠加层(使用具有透明背景的视图,在其中添加一些元素作为子视图来覆盖/框架/遮罩选择器的某些部分(如果需要)。您甚至可以使用
cameraViewTransform
更改正在捕获相机图像的相机视图的大小和位置(即变换)。Use the
showsCameraControls
andcameraOverlayView
properties ofUIImagePickerController
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.