簡體   English   中英

如何使用“相機疊加視圖”在實時相機上繪畫:代碼中的問題

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM