2016-06-10 4 views
-2

GPUImageView 기반 응용 프로그램에서 작업 중입니다. 모든 기능을 올바르게 구현했지만 GPUImageview로 스크린 샷을 캡처 할 수 없습니다. 여기iOS GPUImageview를 사용하여 스크린 샷 찍기 프로그래밍 방식으로

enter image description here

나는 또한 내 Github에서의 데모를 첨부했다.

GPUImageview Demo

참고 : 나는 renderInContext와 함께 스크린 샷을 시도 :하지만 나를 위해 그것은 도움이되지 않습니다.

답변

5

질문에서 볼 수 있듯이 GPUImageview를 사용했습니다. GPUImageview는 OpenGL을 사용하므로 UIGraphicsBeginImageContextWithOptions을 사용하여 목표를 달성 할 수 있습니다.

이 방법을 사용하면 목표를 달성 할 수 있습니다.

- (UIImage ​*)snapshot:(UIView *​)view 
{ 
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0); 
    [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES]; 
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 

    return image; 
} 

자세한 내용은 아래 링크를 클릭하십시오.

On iOS 7 and later, how do I take a snapshot of my view and save the result in a UIImage?

+0

와우. 당신은 형제. 재 경기에 감사드립니다. 그것은 작동합니다. –

+0

도와 드리겠습니다. –

관련 문제