SwViewCapture: 一個用起來還不錯的iOS截圖庫
SwViewCapture
A nice iOS View Capture Library which can capture all content.
SwViewCapture could convert all content of UIWebView to a UIImage.
一個用起來還不錯的iOS截圖庫.(支持截取所有內容, 適用于所有ScrollView組成的視圖, 包括WebView)
SwViewCapture支持截取網頁以及ScrollView的所有內容
Feature
- API is more easy to use.
- use swift extension
- Support to capture all content of scrollView.
- eg: UIScrollView, UITableView, UIWebView
- Support capture WKWebView.
- WKWebview is hard to capture;
- Screenshots of WKWebview's content isn't good now
- Flasing will not appear in the process of Screenshots.
- SwCaptureView use a fake screenshots as a cover which over target view. All the action of target will be hidden below the fake screenshots.
功能
-
API更容易使用.
- 使用Extension去封裝API
-
支持截取滾動視圖內的所有內容.
- 支持UIScrollView, UITableView, UIWebView
-
支持截取WKWebView的內容.
- 因為WKWebView的內部實現問題, WKWebView比較難去截屏
- 目前SwViewCapture對WKWebView的截屏也不完美, 還存在一些瑕疵, 尤其表現在CSS樣式為
dispaly: absolute;
的元素上。
-
截圖過程中不會出現視圖閃爍.
- 截圖過程中, 使用一張偽裝截圖遮蓋屏幕, 底層截圖活動不透明化。
Usage
- Capture basic screenshots (size of view's frame)
import SwViewCapture
// ...
view.swCapture { (capturedImage) -> Void in
// capturedImage is a UIImage.
}
- Capture all content screenshots (size of content)
import SwViewCapture
// ...
view.swContentCapture { (capturedImage) -> Void in
// capturedImage is a UIImage.
}
用法
- 普通截屏(屏幕大小)
import SwViewCapture // ... view.swCapture { (capturedImage) -> Void in // capturedImage is a UIImage. }
- 內容截屏(全部內容的大小)
import SwViewCapture // ... view.swContentCapture { (capturedImage) -> Void in // capturedImage is a UIImage. }
Requirement
iOS 8.0+, Swift 2.0+
SwViewCapture is available through CocoaPods now. To Install it, simply and the following line to your Podfile:
pod "SwViewCapture"
License
SwViewCapture is available under the MIT license. See the LICENSE file for more info.
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!