[英]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.