2014-02-21 41 views
0

我有一个问题,以捕获全屏iCarousel。它只能捕获Carousel的索引。无法捕获全屏iCarousel

UIGraphicsBeginImageContext(caputureView.bounds.size); 
    [caputureView.layer renderInContext:UIGraphicsGetCurrentContext()]; 
    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 
+0

什么是'caputureView'?确保你是对的 - 调试。 – Wain

+0

明确输入你想要的和你在输入和传送带视图数据中使用的东西 – Mahe

+0

@DO Sunhour:你是否尝试给出硬编码的屏幕大小..?尝试捕获窗口。 – Nilesh

回答

0

尝试这样:

- (void) getFullScreenScreenShot 
{ 
    AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; 
    UIView* superView = appDelegate.viewController.view; 
    CGRect fullScreenFrame = superView.frame; 
    UIGraphicsBeginImageContextWithOptions(fullScreenFrame.size, YES, 0.0f); 
    CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0.0f, 0.0f); 
    [superView.layer renderInContext: UIGraphicsGetCurrentContext()]; 
    UIImageView* screenShot = [[UIImageView alloc] initWithImage: UIGraphicsGetImageFromCurrentImageContext()]; 
    UIGraphicsEndImageContext(); 
    NSData* imageData = UIImageJPEGRepresentation(screenShot.image, 1.0); 
    NSString* previewFileNamePath = [[CPFileManager documentsPath] stringByAppendingString: @"image.jpg"]; 

    if ([imageData writeToFile: previewFileNamePath 
        atomically: NO]) 
    { 
     NSLog(@"See filename:%@", previewFileNamePath); 
    } 
    else 
    { 
     NSLog(@"Error: %@", previewFileNamePath); 
    } 
} 
+0

它仍然只能得到索引iCarousel ....有没有人有这个问题作为我? –

+0

我编辑了我的答案。我得到了全屏截图,没有任何问题 – stosha