简体   繁体   English

无法捕获iCarousel的全屏

[英]Can't Capture Full Screen of iCarousel

I have a problem to capture full screen of iCarousel . 我在捕获全屏iCarousel时遇到问题 it can capture only index of Carousel only . 它只能捕获轮播指标。

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

Try something like this: 尝试这样的事情:

- (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);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM