Sto tentando di aggiungere la visualizzazione overlay e spostare la funzionalità di scala & nell'immagine acquisita, ma non sono in grado di farlo a causa della vista di sovrapposizione.Spostamento e ridimensionamento non funzionanti quando overlayview è impostato sulla fotocamera
Ecco il mio codice:
-(void)showOverlayCamera
{
UIImagePickerController *pickerObj = [[UIImagePickerController alloc] init];
pickerObj.delegate = self;
pickerObj.allowsEditing = YES;
pickerObj.sourceType = UIImagePickerControllerSourceTypeCamera;
// creating overlayView
UIView* overlayView = [[UIView alloc] initWithFrame:self.view.bounds];
UIImageView *logoImgView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"logo.png"]];
logoImgView.frame=CGRectMake(10, 10, 100, 20);
[overlayView addSubview:logoImgView];
//add lable in overlay view
UILabel *headerLabel=[[UILabel alloc]initWithFrame:CGRectMake(10, logoImgView.frame.origin.y+logoImgView.frame.size.height+10, 250, 40)];
[email protected]"New Scan";
headerLabel.textColor=[UIColor whiteColor];
headerLabel.font=[UIFont fontWithName:@"Helvetica-Bold" size:40];
headerLabel.backgroundColor=[UIColor clearColor];
[overlayView addSubview:headerLabel];
//add square image in overlay view
squareImgView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cameraBorder.png"]];
squareImgView.frame=CGRectMake(60, headerLabel.frame.origin.y+headerLabel.frame.size.height+20, 200, 200);
[overlayView addSubview:squareImgView];
//adding lable in overlay view
UILabel *instructionLabel=[[UILabel alloc]initWithFrame:CGRectMake(60, squareImgView.frame.origin.y+squareImgView.frame.size.height+5, 250, 60)];
instructionLabel.numberOfLines=2;
[email protected]"Focus your mole in the center of square";
instructionLabel.textColor=[UIColor whiteColor];
instructionLabel.font=[UIFont fontWithName:@"Helvetica" size:20];
instructionLabel.backgroundColor=[UIColor clearColor];
[overlayView addSubview:instructionLabel];
[overlayView.layer setOpaque:NO];
overlayView.opaque = NO;
//adding overlay view on camera
[pickerObj setCameraOverlayView:overlayView];
[self presentViewController:pickerObj animated:YES completion:nil];
}
sì johnyu, l'ho provato ma non funziona ancora –
E senza quella finestra di sovrapposizione funziona tutto bene? Inoltre, hai provato a impostare userInteractionEnabled = NO su tutte le sottoview di overlay? – johnyu
sì senza overlay tutto funziona bene.E ho provato tutti i subview userInteractionEnabled = NO; –