繁体   English   中英

如何在不移动使用照片和在iOS中重拍的情况下应用相机功能?

[英]How to apply camera feature without moving to use photo and retake in iOS?

我坚持在UIImage picker控制器中应用方形焦点,以及如何保持在相机页面上而不移动到屏幕下方的其他页面。 请帮我。 我尝试为此实现自定义叠加层,但没有重点关注。 在此处输入图片说明

在我的UIImagePickerController中,首先不显示正方形,但是当我点击屏幕时,正方形会显示出来。

自动对焦图像

下载以上图片(请让您的设计师为您提供更好的图片)并添加到您的项目中。

在创建图像选择器时添加此代码

 UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(createAutoFocus)];
                [overlayView addGestureRecognizer:tap];//overlayview is your custom overlay

然后在您的课程中添加此方法

-(void)createAutoFocus{

    // NSLog(@"click");
 CGPoint touchPoint=[recognizer locationInView:overlayView];//overlayview is your custom overlay
    // NSLog(@"%@", NSStringFromCGPoint(touchPoint));
    UIImageView *imgViewFocus = [[UIImageView alloc] initWithFrame:CGRectMake(touchPoint.x, touchPoint.y, 80, 80)];
    imgViewFocus.image = [UIImage imageNamed:@"focus.png"];
    imgViewFocus.alpha = 0.8;
    [overlayView addSubview:imgViewFocus];
    [imagePickerCustom setCameraOverlayView:overlayView];//your customimagepicker
    [imgViewFocus performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.5];

}

如果您有任何问题,请告诉我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM