如何应用相机功能而无需在iOS中使用照片和重拍?

时间:2016-05-06 04:22:13

标签: ios objective-c camera

我坚持在UIImage拾取器控制器中应用方形焦点以及如何保持在相机页面而不移动到与屏幕下方相同的另一页面。请帮我。我尝试在自定义叠加层中实现此功能,但是方形焦点不会出现。enter image description here

2 个答案:

答案 0 :(得分:0)

在我的UIImagePickerController中,首先不显示方块,但是当我点击屏幕时,它会在那时显示。

答案 1 :(得分:0)

auto focus image

下载上面的图片(请设计师给你更好的图像)并添加到你的项目中。

在创建imagepicker时添加此代码

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

}

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