Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 1030;
ORGANIZATIONNAME = Startry;
TargetAttributes = {
39D6679C1BE202AC00BF0BD7 = {
Expand All @@ -174,7 +174,7 @@
};
buildConfigurationList = 39D667981BE202AC00BF0BD7 /* Build configuration list for PBXProject "Example" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -270,14 +270,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -317,14 +325,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -362,7 +378,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.startry.SwViewCapture.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -378,7 +394,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.startry.SwViewCapture.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/ImageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ImageViewController: UIViewController {

self.imageView = UIImageView()
self.imageView?.image = image
self.imageView?.contentMode = UIViewContentMode.scaleAspectFit
self.imageView?.contentMode = UIView.ContentMode.scaleAspectFit


self.scrollView = UIScrollView()
Expand Down
4 changes: 4 additions & 0 deletions Example/Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>LSApplicationCategoryType</key>
<string></string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>是否允许添加照片到相册?</string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
4 changes: 2 additions & 2 deletions Example/Example/STCollectionViewDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class STCollectionViewDemoController: UIViewController, UICollectionViewDelegate
override func viewDidLoad() {
super.viewDidLoad()

navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItemStyle.plain, target: self, action: #selector(STTableViewDemoController.didCaptureBtnClicked(_:)))
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItem.Style.plain, target: self, action: #selector(STTableViewDemoController.didCaptureBtnClicked(_:)))

let flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = UICollectionViewScrollDirection.vertical;
flowLayout.scrollDirection = UICollectionView.ScrollDirection.vertical;
collectView = UICollectionView(frame: CGRect.zero, collectionViewLayout: flowLayout)

collectView?.dataSource = self
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/STDemoAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class STDemoAppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
internal func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

self.window = UIWindow(frame: UIScreen.main.bounds)
Expand Down
36 changes: 18 additions & 18 deletions Example/Example/STMenuDemoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ class STMenuDemoViewController: UIViewController {
let oldWebViewBtn = UIButton()
let collectBtn = UIButton()

viewBtn.setTitleColor(UIColor.black, for: UIControlState.normal)
scrollViewBtn.setTitleColor(UIColor.black, for: UIControlState.normal)
tableViewBtn.setTitleColor(UIColor.black, for: UIControlState.normal)
webViewBtn.setTitleColor(UIColor.black, for: UIControlState.normal)
oldWebViewBtn.setTitleColor(UIColor.black, for: UIControlState.normal)
collectBtn.setTitleColor(UIColor.black, for: UIControlState.normal)
viewBtn.setTitleColor(UIColor.black, for: UIControl.State.normal)
scrollViewBtn.setTitleColor(UIColor.black, for: UIControl.State.normal)
tableViewBtn.setTitleColor(UIColor.black, for: UIControl.State.normal)
webViewBtn.setTitleColor(UIColor.black, for: UIControl.State.normal)
oldWebViewBtn.setTitleColor(UIColor.black, for: UIControl.State.normal)
collectBtn.setTitleColor(UIColor.black, for: UIControl.State.normal)

viewBtn.setTitle("View示例", for: UIControlState.normal)
scrollViewBtn.setTitle("ScrollView示例", for: UIControlState.normal)
tableViewBtn.setTitle("TableView示例", for: UIControlState.normal)
webViewBtn.setTitle("WKWebView示例", for: UIControlState.normal)
oldWebViewBtn.setTitle("UIWebView示例", for: UIControlState.normal)
collectBtn.setTitle("CollectionView示例", for: UIControlState.normal)
viewBtn.setTitle("View示例", for: UIControl.State.normal)
scrollViewBtn.setTitle("ScrollView示例", for: UIControl.State.normal)
tableViewBtn.setTitle("TableView示例", for: UIControl.State.normal)
webViewBtn.setTitle("WKWebView示例", for: UIControl.State.normal)
oldWebViewBtn.setTitle("UIWebView示例", for: UIControl.State.normal)
collectBtn.setTitle("CollectionView示例", for: UIControl.State.normal)

view.addSubview(viewBtn)
view.addSubview(scrollViewBtn)
Expand All @@ -65,12 +65,12 @@ class STMenuDemoViewController: UIViewController {

let actionSel = #selector(STMenuDemoViewController.didBtnClicked(_:))

viewBtn.addTarget(self, action: actionSel, for: UIControlEvents.touchUpInside)
scrollViewBtn.addTarget(self, action: actionSel, for: UIControlEvents.touchUpInside)
tableViewBtn.addTarget(self, action: actionSel, for: UIControlEvents.touchUpInside)
webViewBtn.addTarget(self, action: actionSel, for: UIControlEvents.touchUpInside)
oldWebViewBtn.addTarget(self, action: actionSel, for: UIControlEvents.touchUpInside)
collectBtn.addTarget(self, action: actionSel, for: UIControlEvents.touchUpInside)
viewBtn.addTarget(self, action: actionSel, for: UIControl.Event.touchUpInside)
scrollViewBtn.addTarget(self, action: actionSel, for: UIControl.Event.touchUpInside)
tableViewBtn.addTarget(self, action: actionSel, for: UIControl.Event.touchUpInside)
webViewBtn.addTarget(self, action: actionSel, for: UIControl.Event.touchUpInside)
oldWebViewBtn.addTarget(self, action: actionSel, for: UIControl.Event.touchUpInside)
collectBtn.addTarget(self, action: actionSel, for: UIControl.Event.touchUpInside)

self.viewBtn = viewBtn
self.scrollViewBtn = scrollViewBtn
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/STScrollViewDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class STScrollViewDemoController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItemStyle.plain, target: self, action: #selector(STScrollViewDemoController.didCaptureBtnClicked(_:)))
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItem.Style.plain, target: self, action: #selector(STScrollViewDemoController.didCaptureBtnClicked(_:)))

// Add Some Color View for Capture
let orangeView = UIView(frame: CGRect(x: 30, y: 100, width: 100, height: 100))
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/STTableViewDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class STTableViewDemoController: UIViewController, UITableViewDelegate, UITableV
override func viewDidLoad() {
super.viewDidLoad()

navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItemStyle.plain, target: self, action: #selector(STTableViewDemoController.didCaptureBtnClicked(_:)))
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItem.Style.plain, target: self, action: #selector(STTableViewDemoController.didCaptureBtnClicked(_:)))

tableView = UITableView() // tableView

Expand Down
2 changes: 1 addition & 1 deletion Example/Example/STUIWebViewDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class STUIWebViewDemoController: UIViewController {

view.backgroundColor = UIColor.red

navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItemStyle.plain, target: self, action: #selector(STUIWebViewDemoController.didCaptureBtnClicked(_:)))
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItem.Style.plain, target: self, action: #selector(STUIWebViewDemoController.didCaptureBtnClicked(_:)))

webView = UIWebView(frame: view.bounds)
let url = URL(string: "http://www.startry.com")
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/STViewDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class STViewDemoController: UIViewController {
super.viewDidLoad()

view.backgroundColor = UIColor.yellow
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItemStyle.plain, target: self, action: #selector(STViewDemoController.didCaptureBtnClicked(_:)))
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItem.Style.plain, target: self, action: #selector(STViewDemoController.didCaptureBtnClicked(_:)))

// Add Some Color View for Capture
let orangeView = UIView(frame: CGRect(x: 100, y: 100, width: 20, height: 50))
Expand Down
35 changes: 17 additions & 18 deletions Example/Example/STWKWebViewDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,51 @@ import UIKit
import WebKit

class STWKWebViewDemoController: UIViewController {

var webView: WKWebView?

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = UIColor.red
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItemStyle.plain, target: self, action: #selector(STWKWebViewDemoController.didCaptureBtnClicked(_:)))

navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Capture", style: UIBarButtonItem.Style.plain, target: self, action: #selector(STWKWebViewDemoController.didCaptureBtnClicked(_:)))

webView = WKWebView(frame: self.view.bounds)
let url = URL(string: "http://www.startry.com")
let request = URLRequest(url: url!)
_ = webView?.load(request)

view.addSubview(webView!)
}

// override func viewWillAppear(animated: Bool) {
// self.navigationController?.setNavigationBarHidden(true, animated: animated)
// }

// override func viewDidAppear(animated: Bool) {
// super.viewDidAppear(animated)
// self.didCaptureBtnClicked(nil)
// }

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
// webView?.frame = self.view.bounds
}

// MARK: Events
@objc func didCaptureBtnClicked(_ button: UIButton?){

webView?.swContentCapture({ (capturedImage) -> Void in

UIImageWriteToSavedPhotosAlbum(capturedImage!, self, nil, nil)
@objc func didCaptureBtnClicked(_ button: UIButton?) {

let vc = ImageViewController(image: capturedImage!)
webView?.swContentCapture({ (capturedImage) -> Void in
guard let image = capturedImage else { return }
UIImageWriteToSavedPhotosAlbum(image, self, nil, nil)
let vc = ImageViewController(image: image)
self.navigationController?.pushViewController(vc, animated: true)
})

// webView?.swContentScrollCapture({ (capturedImage) -> Void in
// UIImageWriteToSavedPhotosAlbum(capturedImage!, self, nil, nil)
//
//
// let vc = ImageViewController(image: capturedImage!)
// self.navigationController?.pushViewController(vc, animated: true)
// })
Expand Down
29 changes: 24 additions & 5 deletions SwViewCapture.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,22 @@
39D667801BE2024900BF0BD7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1030;
ORGANIZATIONNAME = Startry;
TargetAttributes = {
39D667881BE2024900BF0BD7 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 1030;
};
};
};
buildConfigurationList = 39D667831BE2024900BF0BD7 /* Build configuration list for PBXProject "SwViewCapture" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 39D6677F1BE2024900BF0BD7;
productRefGroup = 39D6678A1BE2024900BF0BD7 /* Products */;
Expand Down Expand Up @@ -153,18 +154,27 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -203,18 +213,27 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -263,7 +282,7 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -285,7 +304,7 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Loading