[英]How to apply camera feature without moving to use photo and retake in iOS?
在我的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.