开发者

UIWebView pagination

开发者 https://www.devze.com 2023-01-02 04:43 出处:网络
I have a large html content to render in a UIWebView, I want to display the content in pages just like a book and the user uses buttons to navigate the pages. Is there any way to calculate the height

I have a large html content to render in a UIWebView, I want to display the content in pages just like a book and the user uses buttons to navigate the pages. Is there any way to calculate the height of html content that fits开发者_如何学Go in the webview without scrolling?


If anyone comes around, in iOS7 and more you can just do :

self.webview.paginationBreakingMode = UIWebPaginationBreakingModePage;
self.webview.paginationMode = UIWebPaginationModeLeftToRight;


for (id subview in self.webView.subviews) 
{
    if ([[subview class] isSubclassOfClass:[UIScrollView class]])
    {
        ((UIScrollView *)subview).pagingEnabled = YES;
        break;
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消