diff --git a/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgress.h b/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgress.h deleted file mode 100755 index 1e1ac3e..0000000 --- a/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgress.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// NJKWebViewProgress.h -// -// Created by Satoshi Aasano on 4/20/13. -// Copyright (c) 2013 Satoshi Asano. All rights reserved. -// - -#import -#import - -#undef njk_weak -#if __has_feature(objc_arc_weak) -#define njk_weak weak -#else -#define njk_weak unsafe_unretained -#endif - -extern const float NJKInitialProgressValue; -extern const float NJKInteractiveProgressValue; -extern const float NJKFinalProgressValue; - -typedef void (^NJKWebViewProgressBlock)(float progress); -@protocol NJKWebViewProgressDelegate; -@interface NJKWebViewProgress : NSObject -@property (nonatomic, njk_weak) idprogressDelegate; -@property (nonatomic, njk_weak) idwebViewProxyDelegate; -@property (nonatomic, copy) NJKWebViewProgressBlock progressBlock; -@property (nonatomic, readonly) float progress; // 0.0..1.0 - -- (void)reset; -@end - -@protocol NJKWebViewProgressDelegate -- (void)webViewProgress:(NJKWebViewProgress *)webViewProgress updateProgress:(float)progress; -@end - diff --git "a/TO/TOWebViewController/\350\257\264\346\230\216.txt" "b/TO/TOWebViewController/\350\257\264\346\230\216.txt" deleted file mode 100644 index 40b4c27..0000000 --- "a/TO/TOWebViewController/\350\257\264\346\230\216.txt" +++ /dev/null @@ -1,2 +0,0 @@ -UIWebView的优秀in app browser -阅读源码,裁剪它,使得契合需要 diff --git a/WebViewCompatible.xcworkspace/xcuserdata/alldk.xcuserdatad/UserInterfaceState.xcuserstate b/WebViewCompatible.xcworkspace/xcuserdata/alldk.xcuserdatad/UserInterfaceState.xcuserstate index 1d0fdbc..504cfa0 100644 Binary files a/WebViewCompatible.xcworkspace/xcuserdata/alldk.xcuserdatad/UserInterfaceState.xcuserstate and b/WebViewCompatible.xcworkspace/xcuserdata/alldk.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/webViewCompatible/webViewCompatible.xcodeproj/project.pbxproj b/webViewCompatible/webViewCompatible.xcodeproj/project.pbxproj index 5fa3a5e..b8ede4a 100644 --- a/webViewCompatible/webViewCompatible.xcodeproj/project.pbxproj +++ b/webViewCompatible/webViewCompatible.xcodeproj/project.pbxproj @@ -9,51 +9,54 @@ /* Begin PBXBuildFile section */ 6C33549C1F356EE0006D9804 /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C33549B1F356EE0006D9804 /* SafariServices.framework */; }; 6C42508A1F3460DB00BCD710 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4250891F3460DB00BCD710 /* main.m */; }; - 6C42508D1F3460DB00BCD710 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C42508C1F3460DB00BCD710 /* AppDelegate.m */; }; 6C4250901F3460DB00BCD710 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C42508F1F3460DB00BCD710 /* ViewController.m */; }; 6C4250931F3460DB00BCD710 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6C4250911F3460DB00BCD710 /* Main.storyboard */; }; 6C4250951F3460DB00BCD710 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6C4250941F3460DB00BCD710 /* Assets.xcassets */; }; 6C4250981F3460DB00BCD710 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6C4250961F3460DB00BCD710 /* LaunchScreen.storyboard */; }; - 6C4250B21F34614400BCD710 /* NJKWebViewProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4250A81F34614300BCD710 /* NJKWebViewProgress.m */; }; - 6C4250B31F34614400BCD710 /* NJKWebViewProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4250AA1F34614400BCD710 /* NJKWebViewProgressView.m */; }; - 6C4250B41F34614400BCD710 /* TOActivitySafari.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4250AC1F34614400BCD710 /* TOActivitySafari.m */; }; - 6C4250B51F34614400BCD710 /* TOWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4250AE1F34614400BCD710 /* TOWebViewController.m */; }; - 6C4250B61F34614400BCD710 /* UIImage+TOWebViewControllerIcons.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4250B01F34614400BCD710 /* UIImage+TOWebViewControllerIcons.m */; }; - 6C4250B71F34614400BCD710 /* 说明.txt in Resources */ = {isa = PBXBuildFile; fileRef = 6C4250B11F34614400BCD710 /* 说明.txt */; }; - 6C4250BD1F34615600BCD710 /* DZNWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4250BB1F34615600BCD710 /* DZNWebViewController.m */; }; - 6C4250C01F34618C00BCD710 /* WebviewCompatibleTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4250BF1F34618C00BCD710 /* WebviewCompatibleTool.m */; }; 6C4250C51F346DD900BCD710 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C4250C41F346DD900BCD710 /* WebKit.framework */; }; + 6C6DF2AE1F3AF68200F1CCEC /* DKActivitySafari.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C6DF29D1F3AF68200F1CCEC /* DKActivitySafari.m */; }; + 6C6DF2AF1F3AF68200F1CCEC /* DKUIWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C6DF29F1F3AF68200F1CCEC /* DKUIWebViewController.m */; }; + 6C6DF2B01F3AF68200F1CCEC /* DKWKWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C6DF2A21F3AF68200F1CCEC /* DKWKWebViewController.m */; }; + 6C6DF2B11F3AF68200F1CCEC /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6C6DF2A31F3AF68200F1CCEC /* Info.plist */; }; + 6C6DF2B21F3AF68200F1CCEC /* DKWebViewProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C6DF2A61F3AF68200F1CCEC /* DKWebViewProgress.m */; }; + 6C6DF2B31F3AF68200F1CCEC /* DKWebViewProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C6DF2A81F3AF68200F1CCEC /* DKWebViewProgressView.m */; }; + 6C6DF2B41F3AF68200F1CCEC /* ReadMe.txt in Resources */ = {isa = PBXBuildFile; fileRef = 6C6DF2A91F3AF68200F1CCEC /* ReadMe.txt */; }; + 6C6DF2B51F3AF68200F1CCEC /* UIImage+DKWebViewControllerIcons.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C6DF2AB1F3AF68200F1CCEC /* UIImage+DKWebViewControllerIcons.m */; }; + 6C6DF2B61F3AF68200F1CCEC /* WebviewCompatibleTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C6DF2AD1F3AF68200F1CCEC /* WebviewCompatibleTool.m */; }; + 6C6DF2B91F3AF6D600F1CCEC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C6DF2B81F3AF6D600F1CCEC /* AppDelegate.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 6C33549B1F356EE0006D9804 /* SafariServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SafariServices.framework; path = System/Library/Frameworks/SafariServices.framework; sourceTree = SDKROOT; }; 6C4250851F3460DB00BCD710 /* webViewCompatible.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = webViewCompatible.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6C4250891F3460DB00BCD710 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 6C42508B1F3460DB00BCD710 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 6C42508C1F3460DB00BCD710 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 6C42508E1F3460DB00BCD710 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 6C42508F1F3460DB00BCD710 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 6C4250921F3460DB00BCD710 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 6C4250941F3460DB00BCD710 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 6C4250971F3460DB00BCD710 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 6C4250991F3460DB00BCD710 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 6C4250A71F34614300BCD710 /* NJKWebViewProgress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJKWebViewProgress.h; sourceTree = ""; }; - 6C4250A81F34614300BCD710 /* NJKWebViewProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJKWebViewProgress.m; sourceTree = ""; }; - 6C4250A91F34614300BCD710 /* NJKWebViewProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJKWebViewProgressView.h; sourceTree = ""; }; - 6C4250AA1F34614400BCD710 /* NJKWebViewProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJKWebViewProgressView.m; sourceTree = ""; }; - 6C4250AB1F34614400BCD710 /* TOActivitySafari.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOActivitySafari.h; sourceTree = ""; }; - 6C4250AC1F34614400BCD710 /* TOActivitySafari.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOActivitySafari.m; sourceTree = ""; }; - 6C4250AD1F34614400BCD710 /* TOWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOWebViewController.h; sourceTree = ""; }; - 6C4250AE1F34614400BCD710 /* TOWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOWebViewController.m; sourceTree = ""; }; - 6C4250AF1F34614400BCD710 /* UIImage+TOWebViewControllerIcons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+TOWebViewControllerIcons.h"; sourceTree = ""; }; - 6C4250B01F34614400BCD710 /* UIImage+TOWebViewControllerIcons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+TOWebViewControllerIcons.m"; sourceTree = ""; }; - 6C4250B11F34614400BCD710 /* 说明.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "说明.txt"; sourceTree = ""; }; - 6C4250BA1F34615600BCD710 /* DZNWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DZNWebViewController.h; path = ../../DN/Source/Classes/DZNWebViewController.h; sourceTree = ""; }; - 6C4250BB1F34615600BCD710 /* DZNWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DZNWebViewController.m; path = ../../DN/Source/Classes/DZNWebViewController.m; sourceTree = ""; }; - 6C4250BE1F34618C00BCD710 /* WebviewCompatibleTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebviewCompatibleTool.h; sourceTree = ""; }; - 6C4250BF1F34618C00BCD710 /* WebviewCompatibleTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebviewCompatibleTool.m; sourceTree = ""; }; 6C4250C21F346C9400BCD710 /* Macro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Macro.h; sourceTree = ""; }; 6C4250C41F346DD900BCD710 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + 6C6DF29C1F3AF68200F1CCEC /* DKActivitySafari.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKActivitySafari.h; sourceTree = ""; }; + 6C6DF29D1F3AF68200F1CCEC /* DKActivitySafari.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DKActivitySafari.m; sourceTree = ""; }; + 6C6DF29E1F3AF68200F1CCEC /* DKUIWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKUIWebViewController.h; sourceTree = ""; }; + 6C6DF29F1F3AF68200F1CCEC /* DKUIWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DKUIWebViewController.m; sourceTree = ""; }; + 6C6DF2A01F3AF68200F1CCEC /* DKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKWebView.h; sourceTree = ""; }; + 6C6DF2A11F3AF68200F1CCEC /* DKWKWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKWKWebViewController.h; sourceTree = ""; }; + 6C6DF2A21F3AF68200F1CCEC /* DKWKWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DKWKWebViewController.m; sourceTree = ""; }; + 6C6DF2A31F3AF68200F1CCEC /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6C6DF2A51F3AF68200F1CCEC /* DKWebViewProgress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKWebViewProgress.h; sourceTree = ""; }; + 6C6DF2A61F3AF68200F1CCEC /* DKWebViewProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DKWebViewProgress.m; sourceTree = ""; }; + 6C6DF2A71F3AF68200F1CCEC /* DKWebViewProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKWebViewProgressView.h; sourceTree = ""; }; + 6C6DF2A81F3AF68200F1CCEC /* DKWebViewProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DKWebViewProgressView.m; sourceTree = ""; }; + 6C6DF2A91F3AF68200F1CCEC /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; + 6C6DF2AA1F3AF68200F1CCEC /* UIImage+DKWebViewControllerIcons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+DKWebViewControllerIcons.h"; sourceTree = ""; }; + 6C6DF2AB1F3AF68200F1CCEC /* UIImage+DKWebViewControllerIcons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+DKWebViewControllerIcons.m"; sourceTree = ""; }; + 6C6DF2AC1F3AF68200F1CCEC /* WebviewCompatibleTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebviewCompatibleTool.h; sourceTree = ""; }; + 6C6DF2AD1F3AF68200F1CCEC /* WebviewCompatibleTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebviewCompatibleTool.m; sourceTree = ""; }; + 6C6DF2B71F3AF6A300F1CCEC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = DKWebView/AppDelegate.h; sourceTree = ""; }; + 6C6DF2B81F3AF6D600F1CCEC /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -89,13 +92,9 @@ 6C4250871F3460DB00BCD710 /* webViewCompatible */ = { isa = PBXGroup; children = ( - 6C4250BA1F34615600BCD710 /* DZNWebViewController.h */, - 6C4250BB1F34615600BCD710 /* DZNWebViewController.m */, - 6C4250A51F34614300BCD710 /* TOWebViewController */, - 6C42508B1F3460DB00BCD710 /* AppDelegate.h */, - 6C42508C1F3460DB00BCD710 /* AppDelegate.m */, - 6C4250BE1F34618C00BCD710 /* WebviewCompatibleTool.h */, - 6C4250BF1F34618C00BCD710 /* WebviewCompatibleTool.m */, + 6C6DF2B71F3AF6A300F1CCEC /* AppDelegate.h */, + 6C6DF2B81F3AF6D600F1CCEC /* AppDelegate.m */, + 6C6DF29B1F3AF68200F1CCEC /* DKWebView */, 6C42508E1F3460DB00BCD710 /* ViewController.h */, 6C42508F1F3460DB00BCD710 /* ViewController.m */, 6C4250911F3460DB00BCD710 /* Main.storyboard */, @@ -116,40 +115,45 @@ name = "Supporting Files"; sourceTree = ""; }; - 6C4250A51F34614300BCD710 /* TOWebViewController */ = { + 6C4250C31F346DD800BCD710 /* Frameworks */ = { isa = PBXGroup; children = ( - 6C4250A61F34614300BCD710 /* NJKWebViewProgress */, - 6C4250AB1F34614400BCD710 /* TOActivitySafari.h */, - 6C4250AC1F34614400BCD710 /* TOActivitySafari.m */, - 6C4250AD1F34614400BCD710 /* TOWebViewController.h */, - 6C4250AE1F34614400BCD710 /* TOWebViewController.m */, - 6C4250AF1F34614400BCD710 /* UIImage+TOWebViewControllerIcons.h */, - 6C4250B01F34614400BCD710 /* UIImage+TOWebViewControllerIcons.m */, - 6C4250B11F34614400BCD710 /* 说明.txt */, + 6C33549B1F356EE0006D9804 /* SafariServices.framework */, + 6C4250C41F346DD900BCD710 /* WebKit.framework */, ); - name = TOWebViewController; - path = ../../TO/TOWebViewController; + name = Frameworks; sourceTree = ""; }; - 6C4250A61F34614300BCD710 /* NJKWebViewProgress */ = { + 6C6DF29B1F3AF68200F1CCEC /* DKWebView */ = { isa = PBXGroup; children = ( - 6C4250A71F34614300BCD710 /* NJKWebViewProgress.h */, - 6C4250A81F34614300BCD710 /* NJKWebViewProgress.m */, - 6C4250A91F34614300BCD710 /* NJKWebViewProgressView.h */, - 6C4250AA1F34614400BCD710 /* NJKWebViewProgressView.m */, + 6C6DF29C1F3AF68200F1CCEC /* DKActivitySafari.h */, + 6C6DF29D1F3AF68200F1CCEC /* DKActivitySafari.m */, + 6C6DF29E1F3AF68200F1CCEC /* DKUIWebViewController.h */, + 6C6DF29F1F3AF68200F1CCEC /* DKUIWebViewController.m */, + 6C6DF2A01F3AF68200F1CCEC /* DKWebView.h */, + 6C6DF2A11F3AF68200F1CCEC /* DKWKWebViewController.h */, + 6C6DF2A21F3AF68200F1CCEC /* DKWKWebViewController.m */, + 6C6DF2A31F3AF68200F1CCEC /* Info.plist */, + 6C6DF2A41F3AF68200F1CCEC /* NJKWebViewProgress */, + 6C6DF2A91F3AF68200F1CCEC /* ReadMe.txt */, + 6C6DF2AA1F3AF68200F1CCEC /* UIImage+DKWebViewControllerIcons.h */, + 6C6DF2AB1F3AF68200F1CCEC /* UIImage+DKWebViewControllerIcons.m */, + 6C6DF2AC1F3AF68200F1CCEC /* WebviewCompatibleTool.h */, + 6C6DF2AD1F3AF68200F1CCEC /* WebviewCompatibleTool.m */, ); - path = NJKWebViewProgress; + path = DKWebView; sourceTree = ""; }; - 6C4250C31F346DD800BCD710 /* Frameworks */ = { + 6C6DF2A41F3AF68200F1CCEC /* NJKWebViewProgress */ = { isa = PBXGroup; children = ( - 6C33549B1F356EE0006D9804 /* SafariServices.framework */, - 6C4250C41F346DD900BCD710 /* WebKit.framework */, + 6C6DF2A51F3AF68200F1CCEC /* DKWebViewProgress.h */, + 6C6DF2A61F3AF68200F1CCEC /* DKWebViewProgress.m */, + 6C6DF2A71F3AF68200F1CCEC /* DKWebViewProgressView.h */, + 6C6DF2A81F3AF68200F1CCEC /* DKWebViewProgressView.m */, ); - name = Frameworks; + path = NJKWebViewProgress; sourceTree = ""; }; /* End PBXGroup section */ @@ -211,9 +215,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 6C6DF2B11F3AF68200F1CCEC /* Info.plist in Resources */, 6C4250981F3460DB00BCD710 /* LaunchScreen.storyboard in Resources */, 6C4250951F3460DB00BCD710 /* Assets.xcassets in Resources */, - 6C4250B71F34614400BCD710 /* 说明.txt in Resources */, + 6C6DF2B41F3AF68200F1CCEC /* ReadMe.txt in Resources */, 6C4250931F3460DB00BCD710 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -225,16 +230,16 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 6C4250B21F34614400BCD710 /* NJKWebViewProgress.m in Sources */, - 6C4250B61F34614400BCD710 /* UIImage+TOWebViewControllerIcons.m in Sources */, - 6C4250B51F34614400BCD710 /* TOWebViewController.m in Sources */, - 6C4250B31F34614400BCD710 /* NJKWebViewProgressView.m in Sources */, + 6C6DF2B61F3AF68200F1CCEC /* WebviewCompatibleTool.m in Sources */, + 6C6DF2AF1F3AF68200F1CCEC /* DKUIWebViewController.m in Sources */, 6C4250901F3460DB00BCD710 /* ViewController.m in Sources */, - 6C4250B41F34614400BCD710 /* TOActivitySafari.m in Sources */, - 6C42508D1F3460DB00BCD710 /* AppDelegate.m in Sources */, - 6C4250BD1F34615600BCD710 /* DZNWebViewController.m in Sources */, 6C42508A1F3460DB00BCD710 /* main.m in Sources */, - 6C4250C01F34618C00BCD710 /* WebviewCompatibleTool.m in Sources */, + 6C6DF2B91F3AF6D600F1CCEC /* AppDelegate.m in Sources */, + 6C6DF2AE1F3AF68200F1CCEC /* DKActivitySafari.m in Sources */, + 6C6DF2B31F3AF68200F1CCEC /* DKWebViewProgressView.m in Sources */, + 6C6DF2B51F3AF68200F1CCEC /* UIImage+DKWebViewControllerIcons.m in Sources */, + 6C6DF2B01F3AF68200F1CCEC /* DKWKWebViewController.m in Sources */, + 6C6DF2B21F3AF68200F1CCEC /* DKWebViewProgress.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/webViewCompatible/webViewCompatible/AppDelegate.h b/webViewCompatible/webViewCompatible/DKWebView/AppDelegate.h similarity index 100% rename from webViewCompatible/webViewCompatible/AppDelegate.h rename to webViewCompatible/webViewCompatible/DKWebView/AppDelegate.h diff --git a/TO/TOWebViewController/TOActivitySafari.h b/webViewCompatible/webViewCompatible/DKWebView/DKActivitySafari.h similarity index 91% rename from TO/TOWebViewController/TOActivitySafari.h rename to webViewCompatible/webViewCompatible/DKWebView/DKActivitySafari.h index 0632a59..71a03e9 100644 --- a/TO/TOWebViewController/TOActivitySafari.h +++ b/webViewCompatible/webViewCompatible/DKWebView/DKActivitySafari.h @@ -1,5 +1,5 @@ // -// TOActivitySafari.h +// DKActivitySafari.h // // Copyright 2013-2016 Timothy Oliver. All rights reserved. // @@ -22,8 +22,8 @@ #import -extern NSString *const TOActivityTypeSafari; +extern NSString *const DKActivityTypeSafari; -@interface TOActivitySafari : UIActivity +@interface DKActivitySafari : UIActivity @end diff --git a/TO/TOWebViewController/TOActivitySafari.m b/webViewCompatible/webViewCompatible/DKWebView/DKActivitySafari.m similarity index 99% rename from TO/TOWebViewController/TOActivitySafari.m rename to webViewCompatible/webViewCompatible/DKWebView/DKActivitySafari.m index a72734c..b0ff17c 100644 --- a/TO/TOWebViewController/TOActivitySafari.m +++ b/webViewCompatible/webViewCompatible/DKWebView/DKActivitySafari.m @@ -1,5 +1,5 @@ // -// TOActivitySafari.m +// DKActivitySafari.m // // Copyright 2013-2016 Timothy Oliver. All rights reserved. // @@ -20,9 +20,9 @@ // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#import "TOActivitySafari.h" +#import "DKActivitySafari.h" -NSString *const TOActivityTypeSafari = @"au.com.timoliver.TOActivityTypeSafari"; +NSString *const DKActivityTypeSafari = @"com.alldk.DKActivityTypeSafari"; /* Detect if we're running iOS 7.0 or higher */ #ifndef NSFoundationVersionNumber_iOS_6_1 @@ -33,7 +33,7 @@ /* Detect which user idiom we're running on */ #define IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) -@interface TOActivitySafari () +@interface DKActivitySafari () /* The URL to load */ @property (nonatomic, strong) NSURL *url; @@ -42,12 +42,12 @@ + (UIImage *)sharedActivityImage; @end -@implementation TOActivitySafari +@implementation DKActivitySafari #pragma mark - Activity Display Properties - - (NSString *)activityType { - return TOActivityTypeSafari; + return DKActivityTypeSafari; } - (NSString *)activityTitle @@ -57,7 +57,7 @@ - (NSString *)activityTitle - (UIImage *)activityImage { - return [TOActivitySafari sharedActivityImage]; + return [DKActivitySafari sharedActivityImage]; } #pragma mark - Activity Action Handlers - diff --git a/TO/TOWebViewController/TOWebViewController.h b/webViewCompatible/webViewCompatible/DKWebView/DKUIWebViewController.h similarity index 94% rename from TO/TOWebViewController/TOWebViewController.h rename to webViewCompatible/webViewCompatible/DKWebView/DKUIWebViewController.h index 0ee13c4..496dd6a 100755 --- a/TO/TOWebViewController/TOWebViewController.h +++ b/webViewCompatible/webViewCompatible/DKWebView/DKUIWebViewController.h @@ -1,5 +1,5 @@ // -// TOWebViewController.h +// DKUIWebViewController.h // // Copyright 2013-2016 Timothy Oliver. All rights reserved. // @@ -22,23 +22,23 @@ #import -@interface TOWebViewController : UIViewController +@interface DKUIWebViewController : UIViewController /** - Initializes a new `TOWebViewController` object with the specified URL. + Initializes a new `DKUIWebViewController` object with the specified URL. @param url The URL to the web page that the controller will initially display. - @return The newly initialized `TOWebViewController` object. + @return The newly initialized `DKUIWebViewController` object. */ - (instancetype)initWithURL:(NSURL *)url; /** - Initializes a new `TOWebViewController` object with the specified URL string. + Initializes a new `DKUIWebViewController` object with the specified URL string. @param urlString The URL as a string, of the web page that the controller will initially display. - @return The newly initialized `TOWebViewController` object. + @return The newly initialized `DKUIWebViewController` object. */ - (instancetype)initWithURLString:(NSString *)urlString; diff --git a/TO/TOWebViewController/TOWebViewController.m b/webViewCompatible/webViewCompatible/DKWebView/DKUIWebViewController.m similarity index 98% rename from TO/TOWebViewController/TOWebViewController.m rename to webViewCompatible/webViewCompatible/DKWebView/DKUIWebViewController.m index b7dd793..3d31a00 100755 --- a/TO/TOWebViewController/TOWebViewController.m +++ b/webViewCompatible/webViewCompatible/DKWebView/DKUIWebViewController.m @@ -1,5 +1,5 @@ // -// TOWebViewController.m +// DKUIWebViewController.m // // Copyright 2013-2016 Timothy Oliver. All rights reserved. // @@ -20,13 +20,13 @@ // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#import "TOWebViewController.h" -#import "TOActivitySafari.h" +#import "DKUIWebViewController.h" +#import "DKActivitySafari.h" -#import "UIImage+TOWebViewControllerIcons.h" +#import "UIImage+DKWebViewControllerIcons.h" -#import "NJKWebViewProgress.h" -#import "NJKWebViewProgressView.h" +#import "DKWebViewProgress.h" +#import "DKWebViewProgressView.h" #import #import @@ -60,11 +60,11 @@ #pragma mark - #pragma mark Hidden Properties/Methods -@interface TOWebViewController () + DKWebViewProgressDelegate,CAAnimationDelegate> { //The state of the UIWebView's scroll view before the rotation animation has started @@ -91,7 +91,7 @@ @interface TOWebViewController () navDelegate; +@property (nonatomic, weak) id navDelegate; @end -@protocol DZNNavigationDelegate +@protocol DKNavigationDelegate -- (void)webView:(DZNWebView *)webView didUpdateProgress:(CGFloat)progress; +- (void)webView:(DKWKWebView *)webView didUpdateProgress:(CGFloat)progress; @end @@ -67,7 +67,7 @@ typedef NS_OPTIONS(NSUInteger, DZNWebNavigationPrompt) { /** A very simple web browser with useful navigation and tooling features. */ -@interface DZNWebViewController : UIViewController +@interface DKWKWebViewController : UIViewController /* lzy注170805: 把TO的『done』按钮的移植过来 @@ -89,15 +89,15 @@ typedef NS_OPTIONS(NSUInteger, DZNWebNavigationPrompt) { /** The web view that the controller manages. */ -@property (nonatomic, strong) DZNWebView *webView; +@property (nonatomic, strong) DKWKWebView *webView; /** The URL identifying the location of the content to load. */ @property (nonatomic, readwrite) NSURL *URL; /** The supported navigation tool bar items. Default is All. */ -@property (nonatomic, readwrite) DZNWebNavigationTools supportedWebNavigationTools; +@property (nonatomic, readwrite) DKWKWebNavigationTools supportedWebNavigationTools; /** The supported actions like sharing and copy link, add to reading list, open in Safari, etc. Default is All. */ -@property (nonatomic, readwrite) DZNsupportedWebActions supportedWebActions; -/** The information to be shown on navigation bar. Default is DZNWebNavigationPromptAll. */ -@property (nonatomic, readwrite) DZNWebNavigationPrompt webNavigationPrompt; +@property (nonatomic, readwrite) DKsupportedWebActions supportedWebActions; +/** The information to be shown on navigation bar. Default is DKWKWebNavigationPromptAll. */ +@property (nonatomic, readwrite) DKWKWebNavigationPrompt webNavigationPrompt; /** Yes if a progress bar indicates the . Default is YES. */ @property (nonatomic) BOOL showLoadingProgress; /** YES if long pressing the backward and forward buttons the navigation history is displayed. Default is YES. */ @@ -117,7 +117,7 @@ typedef NS_OPTIONS(NSUInteger, DZNWebNavigationPrompt) { @param URL The HTTP URL to be requested. @returns The initialized webview controller. */ -- (instancetype)initWithURL:(NSURL *)URL; +- (instancetype)initWithURL:(NSURL *)URL tab:(BOOL)tab; /** Initializes and returns a newly created webview controller for local HTML navigation. @@ -146,15 +146,15 @@ typedef NS_OPTIONS(NSUInteger, DZNWebNavigationPrompt) { /// @name Appearance customisation ///------------------------------------------------ -// The back button displayed on the tool bar (requieres DZNWebNavigationToolBackward) +// The back button displayed on the tool bar (requieres DKWKWebNavigationToolBackward) @property (nonatomic, strong) UIImage *backwardButtonImage; -// The forward button displayed on the tool bar (requieres DZNWebNavigationToolForward) +// The forward button displayed on the tool bar (requieres DKWKWebNavigationToolForward) @property (nonatomic, strong) UIImage *forwardButtonImage; -// The stop button displayed on the tool bar (requieres DZNWebNavigationToolStopReload) +// The stop button displayed on the tool bar (requieres DKWKWebNavigationToolStopReload) @property (nonatomic, strong) UIImage *stopButtonImage; -// The reload button displayed on the tool bar (requieres DZNWebNavigationToolStopReload) +// The reload button displayed on the tool bar (requieres DKWKWebNavigationToolStopReload) @property (nonatomic, strong) UIImage *reloadButtonImage; -// The action button displayed on the navigation bar (requieres at least 1 DZNsupportedWebActions value) +// The action button displayed on the navigation bar (requieres at least 1 DKsupportedWebActions value) @property (nonatomic, strong) UIImage *actionButtonImage; @@ -162,15 +162,15 @@ typedef NS_OPTIONS(NSUInteger, DZNWebNavigationPrompt) { /// @name Delegate Methods Requiring Super ///------------------------------------------------ -// DZNNavigationDelegate -- (void)webView:(DZNWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER; -- (void)webView:(DZNWebView *)webView didCommitNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER; -- (void)webView:(DZNWebView *)webView didUpdateProgress:(CGFloat)progress NS_REQUIRES_SUPER; -- (void)webView:(DZNWebView *)webView didFinishNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER; -- (void)webView:(DZNWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error NS_REQUIRES_SUPER; +// DKNavigationDelegate +- (void)webView:(DKWKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER; +- (void)webView:(DKWKWebView *)webView didCommitNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER; +- (void)webView:(DKWKWebView *)webView didUpdateProgress:(CGFloat)progress NS_REQUIRES_SUPER; +- (void)webView:(DKWKWebView *)webView didFinishNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER; +- (void)webView:(DKWKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error NS_REQUIRES_SUPER; // WKUIDelegate -- (DZNWebView *)webView:(DZNWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures NS_REQUIRES_SUPER; +- (DKWKWebView *)webView:(DKWKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures NS_REQUIRES_SUPER; // UITableViewDataSource - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView NS_REQUIRES_SUPER; diff --git a/DN/Source/Classes/DZNWebViewController.m b/webViewCompatible/webViewCompatible/DKWebView/DKWKWebViewController.m similarity index 82% rename from DN/Source/Classes/DZNWebViewController.m rename to webViewCompatible/webViewCompatible/DKWebView/DKWKWebViewController.m index d0554c7..ea04270 100644 --- a/DN/Source/Classes/DZNWebViewController.m +++ b/webViewCompatible/webViewCompatible/DKWebView/DKWKWebViewController.m @@ -1,27 +1,27 @@ // -// DZNWebViewController.m -// DZNWebViewController -// https://github.com/dzenbot/DZNWebViewController +// DKWKWebViewController.m +// DKWKWebViewController +// https://github.com/dzenbot/DKWKWebViewController // // Created by Ignacio Romero Zurbuchen on 10/25/13. -// Copyright (c) 2014 DZN Labs. All rights reserved. +// Copyright (c) 2014 DK Labs. All rights reserved. // Licence: MIT-Licence // -#import "DZNWebViewController.h" -#import "UIImage+TOWebViewControllerIcons.h" -#import "TOActivitySafari.h" -//#import "DZNPolyActivity.h" -#define DZN_IS_IPAD ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) -#define DZN_IS_LANDSCAPE ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight) +#import "DKWKWebViewController.h" +#import "UIImage+DKWebViewControllerIcons.h" +#import "DKActivitySafari.h" -static char DZNWebViewControllerKVOContext = 0; +#define DK_IS_IPAD ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) +#define DK_IS_LANDSCAPE ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight) -#pragma mark - ================== DZNWebView ================== +static char DKWKWebViewControllerKVOContext = 0; -@implementation DZNWebView +#pragma mark - ================== DKWKWebView ================== -- (void)setNavDelegate:(id)delegate +@implementation DKWKWebView + +- (void)setNavDelegate:(id)delegate { if (!delegate || (self.navDelegate && ![self.navDelegate isEqual:delegate])) { [self removeObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress))]; @@ -52,10 +52,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N } @end -#pragma mark - ================== DZNWebView ================== +#pragma mark - ================== DKWKWebView ================== -#pragma mark - ================== DZNWebViewController ================== -@interface DZNWebViewController () +#pragma mark - ================== DKWKWebViewController ================== +@interface DKWKWebViewController () /* lzy注170805: TO done btn 移植 */ @@ -77,10 +77,10 @@ @interface DZNWebViewController () @property (nonatomic, weak) UIView *navigationBarSuperView; @property (nonatomic) BOOL completedInitialLoad; - +@property (nonatomic, assign)BOOL tab; @end -@implementation DZNWebViewController +@implementation DKWKWebViewController @synthesize URL = _URL; - (instancetype)init @@ -92,20 +92,22 @@ - (instancetype)init return self; } -- (instancetype)initWithURL:(NSURL *)URL +- (instancetype)initWithURL:(NSURL *)URL tab:(BOOL)tab { NSParameterAssert(URL); - + self = [self init]; if (self) { _URL = URL; + _tab = tab; + self.webView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - tab == YES ? 64 : 0); } return self; } - (instancetype)initWithFileURL:(NSURL *)URL { - return [self initWithURL:URL]; + return [self initWithURL:URL tab:NO]; } - (void)awakeFromNib @@ -116,21 +118,21 @@ - (void)awakeFromNib - (void)commonInit { - self.supportedWebNavigationTools = DZNWebNavigationToolAll; - self.supportedWebActions = DZNWebActionAll; - self.webNavigationPrompt = DZNWebNavigationPromptAll; + self.supportedWebNavigationTools = DKWKWebNavigationToolAll; + self.supportedWebActions = DKWKWebActionAll; + self.webNavigationPrompt = DKWKWebNavigationPromptAll; self.showLoadingProgress = YES; self.hideBarsWithGestures = YES; self.allowHistory = YES; - self.webView = [[DZNWebView alloc] initWithFrame:self.view.bounds configuration:[WKWebViewConfiguration new]]; + self.webView = [[DKWKWebView alloc] initWithFrame:self.view.bounds configuration:[WKWebViewConfiguration new]]; self.webView.backgroundColor = [UIColor whiteColor]; self.webView.allowsBackForwardNavigationGestures = YES; self.webView.UIDelegate = self; self.webView.navDelegate = self; self.webView.scrollView.delegate = self; - [self.webView addObserver:self forKeyPath:@"loading" options:NSKeyValueObservingOptionNew context:&DZNWebViewControllerKVOContext]; + [self.webView addObserver:self forKeyPath:@"loading" options:NSKeyValueObservingOptionNew context:&DKWKWebViewControllerKVOContext]; self.completedInitialLoad = NO; /* lzy注170805: TO 的 done btn @@ -323,22 +325,22 @@ - (NSArray *)navigationToolItems UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL]; - if ((self.supportedWebNavigationTools & DZNWebNavigationToolBackward) > 0 || self.supportsAllNavigationTools) { + if ((self.supportedWebNavigationTools & DKWKWebNavigationToolBackward) > 0 || self.supportsAllNavigationTools) { [items addObject:self.backwardBarItem]; } - if ((self.supportedWebNavigationTools & DZNWebNavigationToolForward) > 0 || self.supportsAllNavigationTools) { - if (!DZN_IS_IPAD) [items addObject:flexibleSpace]; + if ((self.supportedWebNavigationTools & DKWKWebNavigationToolForward) > 0 || self.supportsAllNavigationTools) { + if (!DK_IS_IPAD) [items addObject:flexibleSpace]; [items addObject:self.forwardBarItem]; } - if ((self.supportedWebNavigationTools & DZNWebNavigationToolStopReload) > 0 || self.supportsAllNavigationTools) { - if (!DZN_IS_IPAD) [items addObject:flexibleSpace]; + if ((self.supportedWebNavigationTools & DKWKWebNavigationToolStopReload) > 0 || self.supportsAllNavigationTools) { + if (!DK_IS_IPAD) [items addObject:flexibleSpace]; [items addObject:self.stateBarItem]; } if (self.supportedWebActions > 0) { - if (!DZN_IS_IPAD) [items addObject:flexibleSpace]; + if (!DK_IS_IPAD) [items addObject:flexibleSpace]; [items addObject:self.actionBarItem]; } @@ -347,13 +349,13 @@ - (NSArray *)navigationToolItems - (BOOL)supportsAllNavigationTools { - return (_supportedWebNavigationTools == DZNWebNavigationToolAll) ? YES : NO; + return (_supportedWebNavigationTools == DKWKWebNavigationToolAll) ? YES : NO; } - (UIImage *)backwardButtonImage { if (!_backwardButtonImage) { - _backwardButtonImage = [UIImage TOWebViewControllerIcon_backButtonWithAttributes:@{}]; + _backwardButtonImage = [UIImage DKWebViewControllerIcon_backButtonWithAttributes:@{}]; } return _backwardButtonImage; } @@ -361,7 +363,7 @@ - (UIImage *)backwardButtonImage - (UIImage *)forwardButtonImage { if (!_forwardButtonImage) { - _forwardButtonImage = [UIImage TOWebViewControllerIcon_forwardButtonWithAttributes:@{}]; + _forwardButtonImage = [UIImage DKWebViewControllerIcon_forwardButtonWithAttributes:@{}]; } return _forwardButtonImage; } @@ -369,7 +371,7 @@ - (UIImage *)forwardButtonImage - (UIImage *)reloadButtonImage { if (!_reloadButtonImage) { - _reloadButtonImage = [UIImage TOWebViewControllerIcon_refreshButtonWithAttributes:@{}]; + _reloadButtonImage = [UIImage DKWebViewControllerIcon_refreshButtonWithAttributes:@{}]; } return _reloadButtonImage; } @@ -377,7 +379,7 @@ - (UIImage *)reloadButtonImage - (UIImage *)stopButtonImage { if (!_stopButtonImage) { - _stopButtonImage = [UIImage TOWebViewControllerIcon_stopButtonWithAttributes:@{}]; + _stopButtonImage = [UIImage DKWebViewControllerIcon_stopButtonWithAttributes:@{}]; } return _stopButtonImage; } @@ -385,7 +387,7 @@ - (UIImage *)stopButtonImage - (UIImage *)actionButtonImage { if (!_actionButtonImage) { - _actionButtonImage = [UIImage TOWebViewControllerIcon_actionButtonWithAttributes:@{}]; + _actionButtonImage = [UIImage DKWebViewControllerIcon_actionButtonWithAttributes:@{}]; } return _actionButtonImage; } @@ -400,8 +402,8 @@ - (NSArray *)applicationActivitiesForItem:(id)item - if ((_supportedWebActions & DZNWebActionOpenSafari) || self.supportsAllActions) { - [activities addObject:[TOActivitySafari new]]; + if ((_supportedWebActions & DKWKWebActionOpenSafari) || self.supportsAllActions) { + [activities addObject:[DKActivitySafari new]]; } @@ -424,13 +426,13 @@ - (NSArray *)applicationActivitiesForItem:(id)item // return types; // } // -// if ((_supportedWebActions & DZNsupportedWebActionshareLink) == 0) { +// if ((_supportedWebActions & DKsupportedWebActionshareLink) == 0) { // [types addObjectsFromArray:@[UIActivityTypeMail, UIActivityTypeMessage, // UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, // UIActivityTypePostToWeibo, UIActivityTypePostToTencentWeibo, // UIActivityTypeAirDrop]]; // } -// if ((_supportedWebActions & DZNWebActionReadLater) == 0 && [item isKindOfClass:[UIImage class]]) { +// if ((_supportedWebActions & DKWKWebActionReadLater) == 0 && [item isKindOfClass:[UIImage class]]) { // [types addObject:UIActivityTypeAddToReadingList]; // } // @@ -439,7 +441,7 @@ - (NSArray *)applicationActivitiesForItem:(id)item - (BOOL)supportsAllActions { - return (_supportedWebActions == DZNWebActionAll) ? YES : NO; + return (_supportedWebActions == DKWKWebActionAll) ? YES : NO; } @@ -460,7 +462,7 @@ - (void)setURL:(NSURL *)URL - (void)setTitle:(NSString *)title { - if (self.webNavigationPrompt == DZNWebNavigationPromptNone) { + if (self.webNavigationPrompt == DKWKWebNavigationPromptNone) { [super setTitle:title]; return; } @@ -527,7 +529,7 @@ - (void)setLoadingError:(NSError *)error - (BOOL)showNavigationPromptTitle { - if ((self.webNavigationPrompt & DZNWebNavigationPromptTitle) > 0 || self.webNavigationPrompt == DZNWebNavigationPromptAll) { + if ((self.webNavigationPrompt & DKWKWebNavigationPromptTitle) > 0 || self.webNavigationPrompt == DKWKWebNavigationPromptAll) { return YES; } return NO; @@ -535,14 +537,14 @@ - (BOOL)showNavigationPromptTitle - (BOOL)showNavigationPromptURL { - if ((self.webNavigationPrompt & DZNWebNavigationPromptURL) > 0 || self.webNavigationPrompt == DZNWebNavigationPromptAll) { + if ((self.webNavigationPrompt & DKWKWebNavigationPromptURL) > 0 || self.webNavigationPrompt == DKWKWebNavigationPromptAll) { return YES; } return NO; } -#pragma mark - DZNWebViewController methods +#pragma mark - DKWKWebViewController methods - (void)loadURL:(NSURL *)URL { @@ -595,7 +597,7 @@ - (void)showBackwardHistory:(UIGestureRecognizer *)sender return; } - [self presentHistoryControllerForTool:DZNWebNavigationToolBackward fromView:sender.view]; + [self presentHistoryControllerForTool:DKWKWebNavigationToolBackward fromView:sender.view]; } - (void)showForwardHistory:(UIGestureRecognizer *)sender @@ -604,10 +606,10 @@ - (void)showForwardHistory:(UIGestureRecognizer *)sender return; } - [self presentHistoryControllerForTool:DZNWebNavigationToolForward fromView:sender.view]; + [self presentHistoryControllerForTool:DKWKWebNavigationToolForward fromView:sender.view]; } -- (void)presentHistoryControllerForTool:(DZNWebNavigationTools)tool fromView:(UIView *)view +- (void)presentHistoryControllerForTool:(DKWKWebNavigationTools)tool fromView:(UIView *)view { UITableViewController *controller = [UITableViewController new]; controller.title = @"历史纪录"; @@ -617,9 +619,9 @@ - (void)presentHistoryControllerForTool:(DZNWebNavigationTools)tool fromView:(UI controller.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissHistoryController)]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller]; - UIView *bar = DZN_IS_IPAD ? self.navigationBar : self.toolbar; + UIView *bar = DK_IS_IPAD ? self.navigationBar : self.toolbar; - if (DZN_IS_IPAD) { + if (DK_IS_IPAD) { UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:navigationController]; [popover presentPopoverFromRect:view.frame inView:bar permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } @@ -630,7 +632,7 @@ - (void)presentHistoryControllerForTool:(DZNWebNavigationTools)tool fromView:(UI - (void)configureToolBars { - if (DZN_IS_IPAD) { + if (DK_IS_IPAD) { self.navigationItem.rightBarButtonItems = [[[self navigationToolItems] reverseObjectEnumerator] allObjects]; } else { @@ -650,12 +652,12 @@ - (void)configureToolBars self.navigationController.hidesBarsWhenVerticallyCompact = self.hideBarsWithGestures; if (self.hideBarsWithGestures) { - [self.navigationBar addObserver:self forKeyPath:@"hidden" options:NSKeyValueObservingOptionNew context:&DZNWebViewControllerKVOContext]; - [self.navigationBar addObserver:self forKeyPath:@"center" options:NSKeyValueObservingOptionNew context:&DZNWebViewControllerKVOContext]; - [self.navigationBar addObserver:self forKeyPath:@"alpha" options:NSKeyValueObservingOptionNew context:&DZNWebViewControllerKVOContext]; + [self.navigationBar addObserver:self forKeyPath:@"hidden" options:NSKeyValueObservingOptionNew context:&DKWKWebViewControllerKVOContext]; + [self.navigationBar addObserver:self forKeyPath:@"center" options:NSKeyValueObservingOptionNew context:&DKWKWebViewControllerKVOContext]; + [self.navigationBar addObserver:self forKeyPath:@"alpha" options:NSKeyValueObservingOptionNew context:&DKWKWebViewControllerKVOContext]; } - if (!DZN_IS_IPAD && self.navigationController.toolbarHidden && self.toolbarItems.count > 0) { + if (!DK_IS_IPAD && self.navigationController.toolbarHidden && self.toolbarItems.count > 0) { [self.navigationController setToolbarHidden:NO]; } } @@ -711,7 +713,7 @@ - (void)presentActivityController:(id)sender // [self presentActivityControllerWithItem:self.webView.URL.absoluteString andTitle:self.webView.title sender:sender]; if (NSClassFromString(@"UIPresentationController")) { - NSArray *browserActivities = @[[TOActivitySafari new]]; + NSArray *browserActivities = @[[DKActivitySafari new]]; UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[self.webView.URL] applicationActivities:browserActivities]; activityViewController.modalPresentationStyle = UIModalPresentationPopover; activityViewController.popoverPresentationController.barButtonItem = sender; @@ -766,19 +768,19 @@ - (void)destroyProgressViewIfNeeded } -#pragma mark - DZNNavigationDelegate methods +#pragma mark - DKNavigationDelegate methods -- (void)webView:(DZNWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation +- (void)webView:(DKWKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation { [self updateStateBarItem]; } -- (void)webView:(DZNWebView *)webView didCommitNavigation:(WKNavigation *)navigation +- (void)webView:(DKWKWebView *)webView didCommitNavigation:(WKNavigation *)navigation { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:[self.webView isLoading]]; } -- (void)webView:(DZNWebView *)webView didUpdateProgress:(CGFloat)progress +- (void)webView:(DKWKWebView *)webView didUpdateProgress:(CGFloat)progress { if (!self.showLoadingProgress) { [self destroyProgressViewIfNeeded]; @@ -805,14 +807,14 @@ - (void)webView:(DZNWebView *)webView didUpdateProgress:(CGFloat)progress [self.progressView setProgress:progress animated:YES]; } -- (void)webView:(DZNWebView *)webView didFinishNavigation:(WKNavigation *)navigation +- (void)webView:(DKWKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { - if (self.webNavigationPrompt > DZNWebNavigationPromptNone) { + if (self.webNavigationPrompt > DKWKWebNavigationPromptNone) { self.title = self.webView.title; } } -- (void)webView:(DZNWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error +- (void)webView:(DKWKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error { [self setLoadingError:error]; @@ -827,7 +829,7 @@ - (void)webView:(DZNWebView *)webView didFailNavigation:(WKNavigation *)navigati #pragma mark - WKUIDelegate methods -- (DZNWebView *)webView:(DZNWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures +- (DKWKWebView *)webView:(DKWKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures { if (!navigationAction.targetFrame.isMainFrame) { [webView loadRequest:navigationAction.request]; @@ -846,10 +848,10 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - if (tableView.tag == DZNWebNavigationToolBackward) { + if (tableView.tag == DKWKWebNavigationToolBackward) { return self.webView.backForwardList.backList.count; } - if (tableView.tag == DZNWebNavigationToolForward) { + if (tableView.tag == DKWKWebNavigationToolForward) { return self.webView.backForwardList.forwardList.count; } return 0; @@ -866,10 +868,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N WKBackForwardListItem *item = nil; - if (tableView.tag == DZNWebNavigationToolBackward) { + if (tableView.tag == DKWKWebNavigationToolBackward) { item = [self.webView.backForwardList.backList objectAtIndex:indexPath.row]; } - if (tableView.tag == DZNWebNavigationToolForward) { + if (tableView.tag == DKWKWebNavigationToolForward) { item = [self.webView.backForwardList.forwardList objectAtIndex:indexPath.row]; } @@ -891,10 +893,10 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath { WKBackForwardListItem *item = nil; - if (tableView.tag == DZNWebNavigationToolBackward) { + if (tableView.tag == DKWKWebNavigationToolBackward) { item = [self.webView.backForwardList.backList objectAtIndex:indexPath.row]; } - if (tableView.tag == DZNWebNavigationToolForward) { + if (tableView.tag == DKWKWebNavigationToolForward) { item = [self.webView.backForwardList.forwardList objectAtIndex:indexPath.row]; } @@ -908,7 +910,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if (context != &DZNWebViewControllerKVOContext) { + if (context != &DKWKWebViewControllerKVOContext) { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; return; } @@ -916,7 +918,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N if ([object isEqual:self.navigationBar]) { // Skips for landscape orientation, since there is no status bar visible on iPhone landscape - if (DZN_IS_LANDSCAPE) { + if (DK_IS_LANDSCAPE) { return; } @@ -939,7 +941,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N center.y = -2.0; self.navigationBar.center = center; - [UIView beginAnimations:@"DZNNavigationBarAnimation" context:nil]; + [UIView beginAnimations:@"DKNavigationBarAnimation" context:nil]; for (UIView *subview in self.navigationBar.subviews) { if (subview != self.navigationBar.subviews[0]) { @@ -990,11 +992,11 @@ - (void)viewDidUnload - (void)dealloc { if (self.hideBarsWithGestures) { - [self.navigationBar removeObserver:self forKeyPath:@"hidden" context:&DZNWebViewControllerKVOContext]; - [self.navigationBar removeObserver:self forKeyPath:@"center" context:&DZNWebViewControllerKVOContext]; - [self.navigationBar removeObserver:self forKeyPath:@"alpha" context:&DZNWebViewControllerKVOContext]; + [self.navigationBar removeObserver:self forKeyPath:@"hidden" context:&DKWKWebViewControllerKVOContext]; + [self.navigationBar removeObserver:self forKeyPath:@"center" context:&DKWKWebViewControllerKVOContext]; + [self.navigationBar removeObserver:self forKeyPath:@"alpha" context:&DKWKWebViewControllerKVOContext]; } - [self.webView removeObserver:self forKeyPath:@"loading" context:&DZNWebViewControllerKVOContext]; + [self.webView removeObserver:self forKeyPath:@"loading" context:&DKWKWebViewControllerKVOContext]; _backwardBarItem = nil; _forwardBarItem = nil; diff --git a/webViewCompatible/webViewCompatible/DKWebView/DKWebView.h b/webViewCompatible/webViewCompatible/DKWebView/DKWebView.h new file mode 100644 index 0000000..02453de --- /dev/null +++ b/webViewCompatible/webViewCompatible/DKWebView/DKWebView.h @@ -0,0 +1,22 @@ +// +// DKWebView.h +// DKWebView +// +// Created by alldk on 2017/8/9. +// Copyright © 2017年 alldk. All rights reserved. +// + +#import + +//! Project version number for DKWebView. +FOUNDATION_EXPORT double DKWebViewVersionNumber; + +//! Project version string for DKWebView. +FOUNDATION_EXPORT const unsigned char DKWebViewVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import +#ifdef __OBJC__ + +#endif + + diff --git a/webViewCompatible/webViewCompatible/DKWebView/Info.plist b/webViewCompatible/webViewCompatible/DKWebView/Info.plist new file mode 100644 index 0000000..f32c333 --- /dev/null +++ b/webViewCompatible/webViewCompatible/DKWebView/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + zh_CN + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgress.h b/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgress.h new file mode 100755 index 0000000..a5694c5 --- /dev/null +++ b/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgress.h @@ -0,0 +1,36 @@ +// +// DKWebViewProgress.h +// +// Created by Satoshi Aasano on 4/20/13. +// Copyright (c) 2013 Satoshi Asano. All rights reserved. +// + +#import +#import + +#undef DK_weak +#if __has_feature(objc_arc_weak) +#define DK_weak weak +#else +#define DK_weak unsafe_unretained +#endif + +extern const float DKInitialProgressValue; +extern const float DKInteractiveProgressValue; +extern const float DKFinalProgressValue; + +typedef void (^DKWebViewProgressBlock)(float progress); +@protocol DKWebViewProgressDelegate; +@interface DKWebViewProgress : NSObject +@property (nonatomic, DK_weak) idprogressDelegate; +@property (nonatomic, DK_weak) idwebViewProxyDelegate; +@property (nonatomic, copy) DKWebViewProgressBlock progressBlock; +@property (nonatomic, readonly) float progress; // 0.0..1.0 + +- (void)reset; +@end + +@protocol DKWebViewProgressDelegate +- (void)webViewProgress:(DKWebViewProgress *)webViewProgress updateProgress:(float)progress; +@end + diff --git a/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgress.m b/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgress.m similarity index 92% rename from TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgress.m rename to webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgress.m index 4b9baa6..7dd06bc 100755 --- a/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgress.m +++ b/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgress.m @@ -1,19 +1,19 @@ // -// NJKWebViewProgress.m +// DKWebViewProgress.m // // Created by Satoshi Aasano on 4/20/13. // Copyright (c) 2013 Satoshi Asano. All rights reserved. // -#import "NJKWebViewProgress.h" +#import "DKWebViewProgress.h" -NSString *completeRPCURLPath = @"/njkwebviewprogressproxy/complete"; +NSString *completeRPCURLPath = @"/DKwebviewprogressproxy/complete"; -const float NJKInitialProgressValue = 0.1f; -const float NJKInteractiveProgressValue = 0.5f; -const float NJKFinalProgressValue = 0.9f; +const float DKInitialProgressValue = 0.1f; +const float DKInteractiveProgressValue = 0.5f; +const float DKFinalProgressValue = 0.9f; -@implementation NJKWebViewProgress +@implementation DKWebViewProgress { NSUInteger _loadingCount; NSUInteger _maxLoadCount; @@ -33,15 +33,15 @@ - (id)init - (void)startProgress { - if (_progress < NJKInitialProgressValue) { - [self setProgress:NJKInitialProgressValue]; + if (_progress < DKInitialProgressValue) { + [self setProgress:DKInitialProgressValue]; } } - (void)incrementProgress { float progress = self.progress; - float maxProgress = _interactive ? NJKFinalProgressValue : NJKInteractiveProgressValue; + float maxProgress = _interactive ? DKFinalProgressValue : DKInteractiveProgressValue; float remainPercent = (float)_loadingCount / (float)_maxLoadCount; float increment = (maxProgress - progress) * remainPercent; progress += increment; diff --git a/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgressView.h b/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgressView.h similarity index 88% rename from TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgressView.h rename to webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgressView.h index 0f7a2ad..cd4fc83 100755 --- a/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgressView.h +++ b/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgressView.h @@ -1,5 +1,5 @@ // -// NJKWebViewProgressView.h +// DKWebViewProgressView.h // iOS 7 Style WebView Progress Bar // // Created by Satoshi Aasano on 11/16/13. @@ -8,7 +8,7 @@ #import -@interface NJKWebViewProgressView : UIView +@interface DKWebViewProgressView : UIView @property (nonatomic) float progress; @property (nonatomic) UIView *progressBarView; diff --git a/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgressView.m b/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgressView.m similarity index 95% rename from TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgressView.m rename to webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgressView.m index bf9fe67..73c75b2 100755 --- a/TO/TOWebViewController/NJKWebViewProgress/NJKWebViewProgressView.m +++ b/webViewCompatible/webViewCompatible/DKWebView/NJKWebViewProgress/DKWebViewProgressView.m @@ -1,13 +1,13 @@ // -// NJKWebViewProgressView.m +// DKWebViewProgressView.m // // Created by Satoshi Aasanoon 11/16/13. // Copyright (c) 2013 Satoshi Asano. All rights reserved. // -#import "NJKWebViewProgressView.h" +#import "DKWebViewProgressView.h" -@implementation NJKWebViewProgressView +@implementation DKWebViewProgressView - (id)initWithFrame:(CGRect)frame { diff --git a/webViewCompatible/webViewCompatible/DKWebView/ReadMe.txt b/webViewCompatible/webViewCompatible/DKWebView/ReadMe.txt new file mode 100644 index 0000000..a52cde2 --- /dev/null +++ b/webViewCompatible/webViewCompatible/DKWebView/ReadMe.txt @@ -0,0 +1,20 @@ +/* lzy注170809: +网络组件组合自: +UIWebView:https://github.com/TimOliver/TOWebViewController/releases/tag/2.2.6 +简化和分析该类库在:https://github.com/github641/TOWebViewController +WKWebView:https://github.com/dzenbot/DZNWebViewController/releases/tag/v3.2 +简化该类库在:https://github.com/github641/DZNWebViewController + +SFSafariViewController使用简单,直接使用原生的。 + +集成的过程在:https://github.com/github641/WebViewCompatible + +修改而来,向开源致敬。 +二、修改内容如下: +1、文件名、类名、带默认前缀的其他变量、方法名称等 +2、`通知`的名称修改 +3、线程、队列的创建标识 + +使用此类库,需要导入WebKit + +*/ diff --git a/TO/TOWebViewController/UIImage+TOWebViewControllerIcons.h b/webViewCompatible/webViewCompatible/DKWebView/UIImage+DKWebViewControllerIcons.h similarity index 72% rename from TO/TOWebViewController/UIImage+TOWebViewControllerIcons.h rename to webViewCompatible/webViewCompatible/DKWebView/UIImage+DKWebViewControllerIcons.h index b6fc9d3..e1e69cd 100644 --- a/TO/TOWebViewController/UIImage+TOWebViewControllerIcons.h +++ b/webViewCompatible/webViewCompatible/DKWebView/UIImage+DKWebViewControllerIcons.h @@ -1,5 +1,5 @@ // -// UIImage+TOWebViewControllerIcons.h +// UIImage+DKWebViewControllerIcons.h // // Copyright 2013-2016 Timothy Oliver. All rights reserved. // @@ -23,16 +23,16 @@ #import /* Keys for each of the theming properties */ -extern const NSString *TOWebViewControllerButtonTintColor; -extern const NSString *TOWebViewControllerButtonBevelOpacity; +extern const NSString *DKWebViewControllerButtonTintColor; +extern const NSString *DKWebViewControllerButtonBevelOpacity; -@interface UIImage (TOWebViewControllerIcons) +@interface UIImage (DKWebViewControllerIcons) /* Navigation Buttons */ -+ (instancetype)TOWebViewControllerIcon_backButtonWithAttributes:(NSDictionary *)attributes; -+ (instancetype)TOWebViewControllerIcon_forwardButtonWithAttributes:(NSDictionary *)attributes; -+ (instancetype)TOWebViewControllerIcon_refreshButtonWithAttributes:(NSDictionary *)attributes; -+ (instancetype)TOWebViewControllerIcon_stopButtonWithAttributes:(NSDictionary *)attributes; -+ (instancetype)TOWebViewControllerIcon_actionButtonWithAttributes:(NSDictionary *)attributes; ++ (instancetype)DKWebViewControllerIcon_backButtonWithAttributes:(NSDictionary *)attributes; ++ (instancetype)DKWebViewControllerIcon_forwardButtonWithAttributes:(NSDictionary *)attributes; ++ (instancetype)DKWebViewControllerIcon_refreshButtonWithAttributes:(NSDictionary *)attributes; ++ (instancetype)DKWebViewControllerIcon_stopButtonWithAttributes:(NSDictionary *)attributes; ++ (instancetype)DKWebViewControllerIcon_actionButtonWithAttributes:(NSDictionary *)attributes; @end diff --git a/TO/TOWebViewController/UIImage+TOWebViewControllerIcons.m b/webViewCompatible/webViewCompatible/DKWebView/UIImage+DKWebViewControllerIcons.m similarity index 97% rename from TO/TOWebViewController/UIImage+TOWebViewControllerIcons.m rename to webViewCompatible/webViewCompatible/DKWebView/UIImage+DKWebViewControllerIcons.m index bc38730..7b063f1 100644 --- a/TO/TOWebViewController/UIImage+TOWebViewControllerIcons.m +++ b/webViewCompatible/webViewCompatible/DKWebView/UIImage+DKWebViewControllerIcons.m @@ -1,5 +1,5 @@ // -// UIImage+TOWebViewControllerIcons.m +// UIImage+DKWebViewControllerIcons.m // // Copyright 2013-2016 Timothy Oliver. All rights reserved. // @@ -21,10 +21,10 @@ // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#import "UIImage+TOWebViewControllerIcons.h" +#import "UIImage+DKWebViewControllerIcons.h" -const NSString *TOWebViewControllerButtonTintColor = @"TOWebViewControllerButtonFillColor"; -const NSString *TOWebViewControllerButtonBevelOpacity = @"TOWebViewControllerButtonBevelOpacity"; +const NSString *DKWebViewControllerButtonTintColor = @"DKWebViewControllerButtonFillColor"; +const NSString *DKWebViewControllerButtonBevelOpacity = @"DKWebViewControllerButtonBevelOpacity"; /* Default iOS 6 Theming Properties */ #define DEFAULT_IPHONE_BUTTON_TINT [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f] @@ -50,12 +50,12 @@ + (void)drawBevelFromFillColor:(UIColor *)fillColor opacity:(CGFloat)opacity; @end -@implementation UIImage (TOWebViewControllerIcons) +@implementation UIImage (DKWebViewControllerIcons) #pragma mark - Private Methods - + (UIColor *)fillColorFromAttributes:(NSDictionary *)attributes { - UIColor *fillColor = attributes[TOWebViewControllerButtonTintColor]; + UIColor *fillColor = attributes[DKWebViewControllerButtonTintColor]; if (fillColor == nil) { if (IPAD) fillColor = DEFAULT_IPAD_BUTTON_TINT; @@ -68,7 +68,7 @@ + (UIColor *)fillColorFromAttributes:(NSDictionary *)attributes + (CGFloat)bevelOpacityFromAttributes:(NSDictionary *)attributes { - NSNumber *opacityNumber = attributes[TOWebViewControllerButtonBevelOpacity]; + NSNumber *opacityNumber = attributes[DKWebViewControllerButtonBevelOpacity]; if (opacityNumber == nil) { if (IPAD) return DEFAULT_IPAD_BEVEL_OPACITY; @@ -108,7 +108,7 @@ + (void)drawBevelFromFillColor:(UIColor *)fillColor opacity:(CGFloat)opacity } #pragma mark - Navigation Buttons - -+ (instancetype)TOWebViewControllerIcon_backButtonWithAttributes:(NSDictionary *)attributes ++ (instancetype)DKWebViewControllerIcon_backButtonWithAttributes:(NSDictionary *)attributes { UIImage *backButtonImage = nil; if (MINIMAL_UI) { @@ -163,7 +163,7 @@ + (instancetype)TOWebViewControllerIcon_backButtonWithAttributes:(NSDictionary * return backButtonImage; } -+ (instancetype)TOWebViewControllerIcon_forwardButtonWithAttributes:(NSDictionary *)attributes ++ (instancetype)DKWebViewControllerIcon_forwardButtonWithAttributes:(NSDictionary *)attributes { UIImage *forwardButtonImage = nil; if (MINIMAL_UI) { @@ -218,7 +218,7 @@ + (instancetype)TOWebViewControllerIcon_forwardButtonWithAttributes:(NSDictionar return forwardButtonImage; } -+ (instancetype)TOWebViewControllerIcon_refreshButtonWithAttributes:(NSDictionary *)attributes ++ (instancetype)DKWebViewControllerIcon_refreshButtonWithAttributes:(NSDictionary *)attributes { UIImage *refreshButtonImage = nil; if (MINIMAL_UI) { @@ -289,7 +289,7 @@ + (instancetype)TOWebViewControllerIcon_refreshButtonWithAttributes:(NSDictionar return refreshButtonImage; } -+ (instancetype)TOWebViewControllerIcon_stopButtonWithAttributes:(NSDictionary *)attributes ++ (instancetype)DKWebViewControllerIcon_stopButtonWithAttributes:(NSDictionary *)attributes { UIImage *stopButtonImage = nil; if (MINIMAL_UI) { @@ -359,7 +359,7 @@ + (instancetype)TOWebViewControllerIcon_stopButtonWithAttributes:(NSDictionary * return stopButtonImage; } -+ (instancetype)TOWebViewControllerIcon_actionButtonWithAttributes:(NSDictionary *)attributes ++ (instancetype)DKWebViewControllerIcon_actionButtonWithAttributes:(NSDictionary *)attributes { UIImage *actionButtonImage = nil; if (MINIMAL_UI) { diff --git a/webViewCompatible/webViewCompatible/WebviewCompatibleTool.h b/webViewCompatible/webViewCompatible/DKWebView/WebviewCompatibleTool.h similarity index 100% rename from webViewCompatible/webViewCompatible/WebviewCompatibleTool.h rename to webViewCompatible/webViewCompatible/DKWebView/WebviewCompatibleTool.h diff --git a/webViewCompatible/webViewCompatible/WebviewCompatibleTool.m b/webViewCompatible/webViewCompatible/DKWebView/WebviewCompatibleTool.m similarity index 74% rename from webViewCompatible/webViewCompatible/WebviewCompatibleTool.m rename to webViewCompatible/webViewCompatible/DKWebView/WebviewCompatibleTool.m index 1a4a9a4..3fc0c9d 100644 --- a/webViewCompatible/webViewCompatible/WebviewCompatibleTool.m +++ b/webViewCompatible/webViewCompatible/DKWebView/WebviewCompatibleTool.m @@ -7,12 +7,12 @@ // #import "WebviewCompatibleTool.h" -#import "TOWebViewController.h" -#import "DZNWebViewController.h" +#import "DKUIWebViewController.h" +#import "DKWKWebViewController.h" #import -#import "Macro.h" +#define SV_GREATER_THAN_OR_EQUAL_TO(v)([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) @interface NSString(DK) - (BOOL)isNotBlank; @@ -45,13 +45,14 @@ + (void)from:(UIViewController *)from toWebBrowserWithPush:(BOOL)isPush url:(NSS UIViewController *vc; - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9.0")) { + if (SV_GREATER_THAN_OR_EQUAL_TO(@"9.0")) { vc = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:url]]; - }else if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")){//WKWebView + }else if (SV_GREATER_THAN_OR_EQUAL_TO(@"8.0")){//WKWebView // DZNWebViewController处理 - DZNWebViewController *tovc = [[DZNWebViewController alloc] initWithURL:[NSURL URLWithString:url]]; +// DKWKWebViewController *tovc = [[DKWKWebViewController alloc] initWithURL:[NSURL URLWithString:url] tab:NO]; + DKUIWebViewController *tovc = [[DKUIWebViewController alloc] initWithURLString:url]; if (isPush) { @@ -64,7 +65,7 @@ + (void)from:(UIViewController *)from toWebBrowserWithPush:(BOOL)isPush url:(NSS }else{//UIWebView // TOWebViewController的处理 - TOWebViewController *tovc = [[TOWebViewController alloc] initWithURLString:url]; + DKUIWebViewController *tovc = [[DKUIWebViewController alloc] initWithURLString:url]; if (isPush) { vc = tovc; diff --git a/webViewCompatible/webViewCompatible/ViewController.m b/webViewCompatible/webViewCompatible/ViewController.m index 971cae4..bdc673e 100644 --- a/webViewCompatible/webViewCompatible/ViewController.m +++ b/webViewCompatible/webViewCompatible/ViewController.m @@ -11,10 +11,10 @@ #import #import "WebviewCompatibleTool.h" -#import "TOWebViewController.h" -#import "DZNWebViewController.h" +#import "DKUIWebViewController.h" +#import "DKWKWebViewController.h" -#import "TOActivitySafari.h" +//#import "TOActivitySafari.h" #import "Macro.h" @@ -43,12 +43,12 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ // 判断,当前显示的控制器是否有 navi管理:有则push,无则present -// [WebviewCompatibleTool from:self toWebBrowserWithPush:NO url:s]; + [WebviewCompatibleTool from:self toWebBrowserWithPush:NO url:s]; - SFSafariViewController *vc = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:s]]; - [self presentViewController:vc animated:YES completion:nil]; - - vc.delegate = self; +// SFSafariViewController *vc = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:s]]; +// [self presentViewController:vc animated:YES completion:nil]; +// +// vc.delegate = self; } @@ -59,12 +59,12 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ @param title the title of the web page. @result Returns an array of UIActivity instances that will be appended to UIActivityViewController. */ -- (NSArray *)safariViewController:(SFSafariViewController *)controller activityItemsForURL:(NSURL *)URL title:(nullable NSString *)title{ - NSLog(@"%s url:%@ title:%@", __func__, URL, title); - - return @[[TOActivitySafari new]]; - -} +//- (NSArray *)safariViewController:(SFSafariViewController *)controller activityItemsForURL:(NSURL *)URL title:(nullable NSString *)title{ +// NSLog(@"%s url:%@ title:%@", __func__, URL, title); +// +// return @[[DKActivitySafari new]]; +// +//} /*! @abstract Delegate callback called when the user taps the Done button. Upon this call, the view controller is dismissed modally. */ - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller{