Code Monkey home page Code Monkey logo

tonyreet / tysnapshotscroll Goto Github PK

View Code? Open in Web Editor NEW
786.0 17.0 95.0 55.44 MB

一句代码保存截图,将 UIScrollView UITableView UICollectionView UIWebView WKWebView 网页 保存 为 长图 查看。Save the scroll view page as an image,support UIScrollView,UITableView,UICollectionView,UIWebView,WKWebView.(Support iOS13)

License: MIT License

Objective-C 93.21% Ruby 6.59% C 0.20%
wkwebview uiwebview uiscrollview uitableview screenshots capture image long picture scrollview

tysnapshotscroll's Introduction

TYSnapshotScroll

English|简体中文

一句代码保存截图,将scrollView相关的页面保存为图片,支持UIScrollView,UITableView,UICollectionView,UIWebView,WKWebView。(支持iOS16)

Save the scroll view page as an image,support UIScrollView,UITableView,UICollectionView,UIWebView,WKWebView。

  • iOS16
  • UIScrollView嵌套UITableVieW
  • UIScrollView
  • UITableView
  • UICollectionView
  • WKWebView
  • UIWebView

  • 0.1.9版本已经去掉UIWebView,如果需要使用UIWebView,请使用"版本号-UIWebView",例如"0.1.9-UIWebView"

  • 修复iOS13ScrollView和WKWebView只能截取一屏的问题,请升级至0.1.4以上版本

  • 使用真机调试,模拟器测试发现有问题

  • iOS 16 UIScrollView 图层有改变,需要升级到0.4.0


方法一:cocopods

  • 1、在Podfile文件里面添加
pod 'TYSnapshotScroll'
  • 2、pod install,对应文件添加头文件
#import <TYSnapshotScroll.h>
  • 3、如果出现提示"Undefined symbols for architecture arm64" 可以在"Other Linker Flags"添加"$(inherited)"

方法二:手动添加

  • 1、下载TYSnapshotScroll,将TYSnapshotScroll放到工程中

  • 2、引入头文件:

#import "TYSnapshotScroll.h"

用法

//在需要截图的地方调用此方法
[TYSnapshotScroll screenSnapshot:yourView finishBlock:^(UIImage *snapShotImage) {
        // doSomething
    }];

正常:
TYSnapshotScroll-w240

UIScrollView嵌套UITableView:
TYSnapshotScroll-w240

tysnapshotscroll's People

Contributors

songjiang1999 avatar tonyreet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tysnapshotscroll's Issues

闪退

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WKWebView screenSnapshotNeedMask:addMaskAfterBlock:finishBlock:]: unrecognized selector sent to instance 0x7f94ea858a00'

WKWebView 长截图问题

WKWebView长截图时,如果WKWebView控件不是占满整个父控件的视图,比如如说底部有个按钮(产品设计的。。。你懂得)。添加的遮盖是不能完全遮住视图的呢。会看到截图的抖动过程

wkwebview

你好,我换个地址用wkwebview截长图 出来是空白的, 有时截下图 然后 点返回 在点截图 就是空白的.

UITextView 也想截图

为何没有直接判断 [snapshotView isKindOfClass:[UIScrollView class]]
我现在 UITextView 也需要截图,看看能加上吗。
我试着加上发现文字截不全。

不支持bitcode

bitcode bundle could not be generated because '/xxx/Pods/TYSnapshotScroll/TYSnapshotScroll/TYSnapshotAuxiliary.framework/TYSnapshotAuxiliary(UIScrollView+TYSnapshotAuxiliary.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build file '/xxx/Pods/TYSnapshotScroll/TYSnapshotScroll/TYSnapshotAuxiliary.framework/TYSnapshotAuxiliary' for architecture armv7

不支持bitcode吗 希望能支持

ld: bitcode bundle could not be generated because '/Users/ycx/Desktop/YCX-iOS/Pods/TYSnapshotScroll/TYSnapshotScroll/TYSnapshotAuxiliary.framework/TYSnapshotAuxiliary(UIScrollView+TYSnapshotAuxiliary.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build file '/Users/ycx/Desktop/YCX-iOS/Pods/TYSnapshotScroll/TYSnapshotScroll/TYSnapshotAuxiliary.framework/TYSnapshotAuxiliary' for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

iOS 13 兼容性

在iOS 13 WKWebView 以下方法会失效
CGRect myFrame = self.frame;
myFrame.origin.y = -((index) * snapshotView.frame.size.height);
self.frame = myFrame;

可改为 [self.scrollView setContentOffset:CGPointMake(0, index * snapshotView.frame.size.height)];

超长图片的内存问题

如果需要保存的webview或者scrollview长度很大,达到上万个点,直接上下文绘制内存会炸,有没有好的思路在这种情况下生成长图

不支持bitcode

TYSnapshotAuxiliary.framework可否开源,或支持bitcode

bitcode bundle could not be generated because 'xxxx/Pods/TYSnapshotScroll/TYSnapshotScroll/TYSnapshotAuxiliary.framework/TYSnapshotAuxiliary(UIScrollView+TYSnapshotAuxiliary.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build file 'xxxx/Pods/TYSnapshotScroll/TYSnapshotScroll/TYSnapshotAuxiliary.framework/TYSnapshotAuxiliary' for architecture arm64

保存的图片模糊

截取网页后保存到手机相册里面 但是打开图片看着好模糊 不清楚

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.