ios6环境下屏幕截图代码:

阅读更多

ios6环境下,屏幕截图代码:

 

+(UIImage*) makeaShot
{
    [CCDirector sharedDirector].nextDeltaTimeZero = YES;
   
    CGSize winSize = [CCDirector sharedDirector].winSize;
   
    CCLayerColor* whitePage = [CCLayerColor layerWithColor:ccc4(255, 255, 255, 0) width:winSize.width height:winSize.height];
    
    whitePage.position = ccp(winSize.width/2, winSize.height/2);
    
    CCRenderTexture* rtx = [CCRenderTexture renderTextureWithWidth:winSize.width height:winSize.height];
    
    [rtx begin];
    
    [whitePage visit];
    
    [[[CCDirector sharedDirector] runningScene] visit];
    
    [rtx end];
    
    return [rtx getUIImageFromBuffer];
}
 

你可能感兴趣的:(ios6环境下屏幕截图代码:)