问题
Im trying to add a url to the back forward list of my WkWebView but I can't seem to find how it can be done. Apple doc shows this link WebBackForwardList and I've tried importing WebKit.h but I can't find the method to add the item: - (void)addItem:(WebHistoryItem *)item
Can anyone point me in the right direction? Thanks!
回答1:
BackForwardList of a WKWebView class is a readonly property and you shouldn't alter it by yourself. Items will be added to (and removed from) this list as the user will navigate through URL's in the given webview.
If for some reason BackForwardList functionality is not enough for your requirements, I would suggest implementing your own navigation stack.
来源:https://stackoverflow.com/questions/30633517/how-to-use-wkwebview-additem-to-backforwardlist