2

I want to go back and forward in my iOS apps WebView using "Screen Edge Pan Gesture Recognizer" like in Apples mobile Safari browser. Best would be if animated like in Safari.

Currently I use "Swipe Gesture Recognizer" but it isn't very easy to use for the users. Especially it doesn't work if user has zoomed the webpage.

Does anybody have a sample code, a manual or any other help?

  • Thanks for your answer. What is WKWebView? I never heard of it. How can I add this? –  Mar 04 '16 at 22:36
  • Okay, thank you for your answer. What will happen if I try to use WKWebView with an OS lower than iOS 8? –  Mar 04 '16 at 23:08
  • I've created separate answer from comments above, just to make sure that this information have proper visibility. – Borys Verebskyi Mar 04 '16 at 23:29

1 Answers1

7

This functionality is much easier to implement in WKWebView. You should simply set allowsBackForwardNavigationGestures property to YES.

WKWebView is a modern replacement for UIWebView, made by Apple. See link for details. You should link with WebKit.framework to use it. Unfortunately there is no Interface Builder support, see this answer.

Note that WKWebView available starting from iOS 8. Most likely you will receive crash on application start on earlier iOS versions. But it's possible to use UIWebView on pre-iOS 8, and WKWebView for iOS 8 and later. Take a look on this github project as an example.

Community
  • 1
  • 1
Borys Verebskyi
  • 4,160
  • 6
  • 28
  • 42