[英]how to paint on live camera using Camera overlay view : issues in code
我正在尝试使应用程序可以在实时摄像机上进行绘制。 为此,我用xib创建了一个名为PaintView
的类,其中所有与绘画相关的功能都在其中运行。
我将paintview
添加到cameraoverlay
视图。 该视图已正确添加。 但是,当我触摸设备的屏幕时,应用程序无法绘制任何内容,并且日志显示以下错误
<错误>:CGContextSetLineWidth:无效的上下文0x11b540
<错误>:CGContextSetRGBStrokeColor:无效的上下文0x11b540
我添加子视图的代码是
// 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];
请帮助我,如何在实时摄像机上绘画!
提前致谢。
编辑 :在画图视图中,我正在创建图像视图,初始化像
drawImage = [[UIImageView alloc] init];
drawImage.frame = CGRectMake(20,20,320,440);
[self.view addSubview:drawImage];
[self.view BringSubviewToFront:drawImage];
嗨,我有解决方案,
我犯了一个错误,因为不需要使用Context,它会产生问题。
我们需要使用UIBezierPath,问题已经解决。 我可以在实时摄像机上绘画。
这里是链接的参考 。
是的.....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.