I am trying to make application to draw on live camera. In that I have created a class with xib called PaintView
, in which all the paint related functionality is running.
I am adding the paintview
to cameraoverlay
view. The view is added properly. But when I am touching the screen of device, the application is not able to draw anything, and the log shows following error
< Error >: CGContextSetLineWidth: invalid context 0x11b540
< Error >: CGContextSetRGBStrokeColor: invalid context 0x11b540
my code for adding sub view is
// Insert the overlay
overlay = [[PaintView alloc] initWithNibName:@"PaintView" bundle:nil];
//overlay.pickerReference = self.imagePicker;
[self.imagePicker.cameraOverlayView addSubview:overlay.view];
[self.imagePicker.cameraOverlayView bringSubviewToFront:overlay.view];
[self.imagePicker.cameraOverlayView setBackgroundColor:[UIColor clearColor]];
//self.imagePicker.delegate = overlay;
[self presentModalViewController:self.imagePicker animated:YES];
Please help me, how to draw on live camera !!!
Thanks in advance.
EDIT : In Paint view I am creating Image view, which is initialized like
drawImage = [[UIImageView alloc] init];
drawImage.frame = CGRectMake(20, 20, 320, 440);
[self.view addSubview:drawImage];
[self.view bringSubviewToFront:drawImage];
Hi I have got the solution ,
I was making mistake, as the Context is not necessary to use, it will create issues.
We need to use UIBezierPath, and the issues are solved. I am able to draw on live camera.
here the reference to the link .
Yea.....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.