12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- //
- // ZCBaseBaseWebView.h
- // HuaKaiChat
- //
- // Created by 张灿 on 2017/6/28.
- // Copyright © 2017年 huakai. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- @class ZCBaseWebView;
- @protocol ZCBaseWebViewDelegate <NSObject>
- @optional
- - (void)webViewDidStartLoad:(ZCBaseWebView * _Nonnull)webView;
- - (void)webViewDidFinishLoad:(ZCBaseWebView * _Nonnull)webView;
- - (void)webView:(ZCBaseWebView * _Nonnull)webView didFailLoadWithError:(nullable NSError *)error;
- - (void)webView:(ZCBaseWebView * _Nonnull)webView updateProgress:(double)progress;
- @end
- @interface ZCBaseWebView : UIView
- /* nav */
- @property (strong, nonatomic) UINavigationController *nav;
- @property(weak,nonatomic)_Nullable id<ZCBaseWebViewDelegate> delegate;
- @property (nonatomic,copy) NSString* contentUrl;
- ///内部使用的webView 如果有WKWebView则realWebView为WKWebView
- @property (nonatomic, readwrite) WKWebView *realWebView;
- //加载进度
- @property (nonatomic, readonly) double estimatedProgress;
- @property (nonatomic, copy) NSString * _Nullable title;
- ///---- UI 或者 WK 的API
- @property (nonatomic, readonly) UIScrollView* _Nullable scrollView;
- - (void)loadRequest:(NSURLRequest * _Nullable)request;
- - (void)loadHTMLString:(NSString * _Nullable)string baseURL:(nullable NSURL *)baseURL;
- - (nullable NSString *)stringByEvaluatingJavaScriptFromString:(NSString * _Nullable)script;
- @property (nullable, nonatomic, readonly, strong) NSURLRequest *request;
- @property (nonatomic, readonly, getter=canGoBack) BOOL canGoBack;
- @property (nonatomic, readonly, getter=canGoForward) BOOL canGoForward;
- @property (nonatomic, readonly, getter=isLoading) BOOL loading;
- @property (nonatomic) BOOL scalesPageToFit;
- @end
- //TLSWebProgressView
- extern const float NJKInitialProgressValue;
- extern const float NJKInteractiveProgressValue;
- extern const float NJKFinalProgressValue;
- typedef void (^ZCBaseWebProgressViewBlock)(float progress);
- @class ZCBaseWebProgressView;
- @protocol ZCBaseWebProgressViewDelegate <NSObject>
- - (void)webViewProgress:(ZCBaseWebProgressView *_Nullable)webViewProgress updateProgress:(float)progress;
- @end
- @interface ZCBaseWebProgressView : NSObject
- @property (nonatomic, weak) id<ZCBaseWebProgressViewDelegate >progressDelegate;
- @property (nonatomic, copy) ZCBaseWebProgressViewBlock progressBlock;
- @property (nonatomic, readonly) float progress; // 0.0..1.0
- - (void)reset;
- @end
|