2012-06-04 27 views
0

我正在嘗試使用現場相機繪製應用程序。在那裏,我創建了一個名爲PaintView的類,其中所有與繪畫相關的功能都在運行。如何使用相機覆蓋視圖在實時相機上繪圖:代碼中的問題

我加入paintviewcameraoverlay視圖。該視圖已正確添加。但是,當我觸摸設備的屏幕,應用程序不能畫任何東西,和日誌顯示以下錯誤

<錯誤>: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]; 

請幫助我,如何在現場攝像機上畫畫!

在此先感謝。

EDIT:油漆視圖我創建圖像視圖,其像

初始化

的drawImage = [[ALLOC的UIImageView] INIT];

drawImage.frame = CGRectMake(20,20,320,440);

[self.view addSubview:的drawImage];

[self.view bringSubviewToFront:的drawImage];

+0

您是否正在繪製drawRect:PaintView方法? – rdelmar

+0

是的,我正在繪製drawRect:方法,下面是代碼 –

+0

drawImage = [[UIImageView alloc] initWithImage:nil]; \t drawImage.frame = self.view.frame; \t [self.view addSubview:drawImage]; [drawImage.image drawInRect:CGRectMake(0,0,drawImage.frame.size.width,drawImage.frame.size.height)]; –

回答

0

您好我已經得到了解決,

我會犯錯,因爲上下文是沒有必要使用,就會產生問題。

我們需要使用UIBezierPath,並且這些問題都解決了。我可以利用現場相機。

here the reference to the link

是啊.....

相關問題