简体   繁体   中英

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

I stuck to apply square focus in UIImage picker controller and how to stay on camera page without moving to another page same like below screen. please help me. I tried to implement in custom overlay for this but in square focus not coming. 在此处输入图片说明

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

自动对焦图像

download the above image(ask your designer to give you better image) and add to your project.

add this code while creating imagepicker

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

then add this method in your class

-(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];

}

Let me know if you have any issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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