Search code examples
htmliosuiwebviewuipageviewcontrollerpage-curl

webpage surfing with page curl animation ios


i have a html file that contains some data,since i display this in a webview the user has to scroll down to view the information,what i want to know is whether i can provide a page curl animation to view the contents of the html so that it becomes easier for the user to read the information by swiping across pages,

should i use pageviewcontroller? or are there any other libraries that let me have the page curl effect on a custom(webview)? how do i proceed? is it possible to show some amount of html information on one page and then user turns to the next page? how do i achieve that,its a single html file


Solution

  • If you want that sort of paging, then maybe you could try the leaves library https://github.com/brow/leaves You can use it to page through various UIWebView's As you can see in the leaves sample you have to render the page in the renderPageAtIndex. You can then use something like:

    - (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx {
    

    CGSize screensize = CGSizeMake(320,480);

    UIGraphicsBeginImageContext(screensize); CGContextRef context = UIGraphicsGetCurrentContext(); CGFloat scalingFactor = screensize.width/webView.frame.size.width; CGContextScaleCTM(context, scalingFactor,scalingFactor);

    [webView.layer renderInContext: ctx]; }

    You do have to load the webview first.