Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigate by page in UIWebView - like setPagingEnabled

Is there a way to navigate within a webview using paging - like UIScrollView's 'pagingEnabled'?

There are several suggestions out there about setting this parameter on UIWebViews internal scrollview, but this solution does not work e.g. in the case that you set the webcontent offset using javascript. In this case, the first tap on the screen will zoom you back to the beginning of the page....

Are there any recommended ways for doing this correctly?

Update
My original problem was of course that I had set paging to enabled and was setting the content offset to a number not equal to a real page boundry...

Question remains though whether there is a better way of performing this task.

like image 938
LK. Avatar asked Oct 16 '10 23:10

LK.


1 Answers

Yes there is a way. Set web-kit CSS to a multi-column flow.

-webkit-column-width

Use javascript 'scrollTo' to scroll to next/previous page

window.scrollTo(xPagePosition, 0)  

Add a UIView with clear background color on top of the UIView to capture the user swipe gesture.

like image 84
RocketMan Avatar answered Sep 18 '22 08:09

RocketMan