zoukankan      html  css  js  c++  java
  • UIScrollView 截图

    - (IBAction) renderScrollViewToImage
        {
            UIImage* image = nil;

            UIGraphicsBeginImageContext(_scrollView.contentSize);
            {
                CGPoint savedContentOffset = _scrollView.contentOffset;
                CGRect savedFrame = _scrollView.frame;
            
                _scrollView.contentOffset = CGPointZero;
                _scrollView.frame = CGRectMake(0, 0, _scrollView.contentSize.width, _scrollView.contentSize.height);
            
                [_scrollView.layer renderInContext: UIGraphicsGetCurrentContext()];        
                image = UIGraphicsGetImageFromCurrentImageContext();
                
                _scrollView.contentOffset = savedContentOffset;
                _scrollView.frame = savedFrame;
            }
            UIGraphicsEndImageContext();

            if (image != nil) {
                [UIImagePNGRepresentation(image) writeToFile: @"/tmp/test.png" atomically: YES];
                system("open /tmp/test.png");
            }
        }

  • 相关阅读:
    宏中的逗号
    DES算法
    [microsoft]PE和COFF文件格式
    [流媒体]VLC主要模块
    [转][C/C++]函数名字修饰(Decorated Name)方式
    [VS]vs的宏
    [windows操作系统]system32下的那些好东西
    [微软]technet与msdn
    [windows驱动]标准驱动例程
    [windows操作系统]内核性能剖析
  • 原文地址:https://www.cnblogs.com/liudongyan/p/4892369.html
Copyright © 2011-2022 走看看