簡體   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