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