ZFWKWebView
is a Highly customizable WKWebView for iOS.
Choose ZFWKWebView
for your next project, or migrate over your existing projects—you'll be happy you did!
CocoaPods is the recommended way to add ZFWKWebView
to your project.
Specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'TargetName' do
pod 'ZFWKWebView', '~> 1.2.2'
end
Then, run the following command:
pod install --repo-update
Alternatively you can directly add the ZFWKWebView.h
and ZFWKWebView.m
source files to your project.
- Download the latest code version or add the repository as a git submodule to your git-tracked project.
- Open your project in Xcode, then drag and drop
ZFWKWebView.h
andZFWKWebView.m
onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project. - Include
ZFWKWebView
wherever you need it with#import "ZFWKWebView.h"
.
Subclass config from ZFWKWebVCConf
@interface ZFWKUserDefaultConf : ZFWKWebVCConf
ZFWKUserDefaultConf *userConf = [[ZFWKUserDefaultConf alloc] init];
ZFWKWebVC *web = [[ZFWKWebVC alloc] initWithConf:userConf];
ZFWKWebVC *web = [[ZFWKWebVC alloc] initWithDefaultConfig];
[web.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.apple.com.cn"]]];
[self presentViewController:web animated:YES completion:nil];
Body is serialization response
[self addMethodName:ZFWKWebViewEventCloseKey callback:^(ZFWKWebVC * _Nonnull target, ZFWKWebVCConf * _Nonnull config, id _Nullable body) {
}];
Per-define event key
ZFWKWebViewEventStartLoadKey
ZFWKWebViewEventStartRecevicedKey
ZFWKWebViewEventFinishRecevicedKey
ZFWKWebViewEventLoadFailedKey
ZFWKWebViewEventRefreshKey
ZFWKWebViewEventCloseKey
ZFWKWebViewEventRightButtonClickKey
ZFWKWebViewEventGoBackKey
ZFWKWebViewEventGoForwardKey
[webVC evaluateJavaScriptMethodName:@"test" params:@{} callback:^(id _Nullable, NSError * _Nullable error) {
}];
self.titleFont = [UIFont systemFontOfSize:33 weight:UIFontWeightBold];
self.titleColor = [UIColor redColor];
self.navigationBackgroundColor = [UIColor greenColor];
self.showRightNavigationButton = YES;
self.rightNavigationButtonTitle = @"Skip";
self.rightNavigationButtonTextFont = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
self.rightNavigationButtonTextColor = [UIColor yellowColor];
self.progressBarHeight = 40;
self.progressTintColor = [UIColor colorWithRed:86/255.0 green:187/255.0 blue:59/255.0 alpha:1];
self.progressBackgroundColor = [UIColor clearColor];
ZFWKUserDefaultConf *userConf = [[ZFWKUserDefaultConf alloc] init];
userConf.progressBarHeight = 40;
userConf.progressTintColor = [UIColor colorWithRed:86/255.0 green:187/255.0 blue:59/255.0 alpha:1];
userConf.progressBackgroundColor = [UIColor clearColor];
self.showBottomBar = YES;
self.showCloseButton = NO;
Copyright (c) 2019 Pokeey
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 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.