https://github.com/mosheberman/scrollviewsnapshotter
A demo project showing how to correctly snapshot the contents UIScrollView and its subclasses.
https://github.com/mosheberman/scrollviewsnapshotter
Last synced: 11 months ago
JSON representation
A demo project showing how to correctly snapshot the contents UIScrollView and its subclasses.
- Host: GitHub
- URL: https://github.com/mosheberman/scrollviewsnapshotter
- Owner: MosheBerman
- License: mit
- Created: 2016-04-11T00:35:41.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-12T16:21:03.000Z (about 10 years ago)
- Last Synced: 2025-04-10T00:15:46.522Z (about 1 year ago)
- Language: Swift
- Size: 26.4 KB
- Stars: 18
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ScrollViewSnapshotter
A demo project showing how to correctly snapshot the contents UIScrollView and its subclasses.
About:
---
Historically, the suggested approach to snapshotting a scrollview was to resize the scroll view's `frame` to match its `contentSize`. This became inconvenient with the introduction of autolayout on iOS.
This example scrolls through the contents of a scrollview subclass (in this case a collection view) and generates a PDF.
The magic comes from translating the core graphics current transformation matrix along with the `contentOffset`. Check out the ScrollViewSnapshotter class for implementation details and a ton of notes. Those notes are also available on [my blog](http://blog.mosheberman.com/generating-a-pdf-from-a-uiscrollview/).
License:
---
MIT