在我的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.