Open ShannonChenCHN opened 7 years ago
参考资料:
——————业界探索——————
属性:
@property (nullable, nonatomic, assign) id <UIWebViewDelegate> delegate;
@property (nonatomic, readonly, strong) UIScrollView *scrollView NS_AVAILABLE_IOS(5_0);
@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;
@property (nonatomic) BOOL detectsPhoneNumbers NS_DEPRECATED_IOS(2_0, 3_0);
@property (nonatomic) UIDataDetectorTypes dataDetectorTypes NS_AVAILABLE_IOS(3_0);
@property (nonatomic) BOOL allowsInlineMediaPlayback NS_AVAILABLE_IOS(4_0);
@property (nonatomic) BOOL mediaPlaybackRequiresUserAction NS_AVAILABLE_IOS(4_0);
@property (nonatomic) BOOL mediaPlaybackAllowsAirPlay NS_AVAILABLE_IOS(5_0);
@property (nonatomic) BOOL suppressesIncrementalRendering NS_AVAILABLE_IOS(6_0);
@property (nonatomic) BOOL keyboardDisplayRequiresUserAction NS_AVAILABLE_IOS(6_0);
@property (nonatomic) UIWebPaginationMode paginationMode NS_AVAILABLE_IOS(7_0);
@property (nonatomic) UIWebPaginationBreakingMode paginationBreakingMode NS_AVAILABLE_IOS(7_0);
@property (nonatomic) CGFloat pageLength NS_AVAILABLE_IOS(7_0);
@property (nonatomic) CGFloat gapBetweenPages NS_AVAILABLE_IOS(7_0);
@property (nonatomic, readonly) NSUInteger pageCount NS_AVAILABLE_IOS(7_0);
@property (nonatomic) BOOL allowsPictureInPictureMediaPlayback NS_AVAILABLE_IOS(9_0);
@property (nonatomic) BOOL allowsLinkPreview
方法:
- (void)loadRequest:(NSURLRequest *)request;
- (void)loadHTMLString:(NSString *)string baseURL:(nullable NSURL *)baseURL;
- (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName baseURL:(NSURL *)baseURL;
- (void)reload;
- (void)stopLoading;
- (void)goBack;
- (void)goForward;
- (nullable NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
webViewDidFinishLoad
方法的一些问题2.1 webViewDidFinishLoad
什么时候被调用
2.2 为什么会出现 loadRequest 一次,webViewDidFinishLoad
却被多次调用的情况?
WebKit 和 Nitro 引擎
URL Loading System
使用 WKWebView 时,如何同步 cookie?
登录/登出时,如何同步 cookie 信息到 WKWebView?
几个问题:
WKWebView 在加载时会缓存数据吗?缓存哪些了数据呢?
如何清除系统缓存
UIWebView
中的 mediaPlaybackRequiresUserAction
、allowsInlineMediaPlayback
和 scalesPageToFit
属性的兼容性处理
Rexxar 主要由以下三部分组成:
Rexxar Container 和 Rexxar Web 之间的交互
Rexxar Container 的技术实现
Rexxar 页面执行过程
实际应用中,基于 UIWebView 的界面的共同特点: 1.排版复杂。 2.界面的变化需求频繁。 3.界面对用户的交互需求不复杂。
1.HTML 片段的基本处理 相关 API:
- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL
HTML 片段格式化:
- (NSString *)demoFormatWithName:(NSString *)name value:(NSString *)value {
NSString *html =
@"<HTML>"
"<HEAD>"
"</HEAD>"
"<BODY>"
"<H1>%@</H1>"
"<p>%@</p>"
"</BODY>"
"</HTML>";
NSString *content = [NSString stringWithFormat:html, name, value];
return content;
}
UIWebView
WKWebView
Web view 与 JavaScript 的交互处理
- webView: shouldStartLoadWithRequest: navigationType:
方法中进行拦截 url 再进行处理UIWebView 中如何加载 webp 图片
cookie 同步问题
Web View 生成快照
JavaScriptCore