iOS uiwebview goBack history control

前端 未结 2 1472
旧巷少年郎
旧巷少年郎 2021-02-14 08:56

I am loading a \"webpage1\" on an uiwebview and saving its first request on an instance variable \"webviewHistory\". Then, I must reuse that webview to load another page, \"webp

2条回答
  •  花落未央
    2021-02-14 09:29

    UIWebviews have instance methods that allow you to go backwards and forwards with the history, without you having to track the last request. Is there a particular reason you are saving the last request specifically?

    Sample code:

    if ([webView canGoBack]) {
        [webView goBack];
    }
    

    Here is a project that is a simple uiwebview browser if you want to play with it: https://github.com/msencenb/UIWebView-Example

提交回复
热议问题