Ios8 如何使用WKWebView加载html字符串

Ios8 如何使用WKWebView加载html字符串,ios8,wkwebview,Ios8,Wkwebview,如何使用WKWebView加载html字符串 我刚刚找到了loadRequest方法。我能想到的唯一方法是将html字符串保存到文件中,然后通过NSURLRequest…加载它。在beta 3中,我在WKWebView中找到了这个方法 /*! @abstract Sets the webpage contents and base URL. @param string The string to use as the contents of the webpage. @pa

如何使用WKWebView加载html字符串


我刚刚找到了
loadRequest
方法。我能想到的唯一方法是将html字符串保存到文件中,然后通过
NSURLRequest

加载它。在beta 3中,我在WKWebView中找到了这个方法

 /*! @abstract Sets the webpage contents and base URL.
     @param string The string to use as the contents of the webpage.
     @param baseURL A URL that is used to resolve relative URLs within the document.
     @result A new navigation.
     */
    func loadHTMLString(string: String!, baseURL: NSURL!) -> WKNavigation!

因此,您可以像使用UIWebView一样加载html字符串

请准确指定您要执行的操作,并添加一些您已经尝试过的代码。