How to Get HTML tag which seen in UIWebView Screen out of all HTML tag loaded in UIWebView

丶灬走出姿态 提交于 2019-12-01 07:48:45

问题


In my UIWebView I loaded the "Chapter.xhtml" file like this.

[webView loadRequest:[NSURLRequest requestWithURL:url]];  

and the whole Chapter.xhtml is loaded in webView.

I am showing it with some JavaScript logic in the webview.

float pageOffset = pageIndex*webView.bounds.size.width;
NSString* goTo =[NSString stringWithFormat:@"pageScroll(%f)", pageOffset];
[webView stringByEvaluatingJavaScriptFromString:goTo];  

From this the New page will come as the button is pressed but page scrolling manually off in webview.

So, if there are four pages with content in the webview, then only one page will come in the webview and as the "next" button is pressed the new page will come.

But I need to get all the HTML tags that are seen on the screen. (only those which are on the screen) not whole loaded HTML in webview.

For getting HTML tags I use NSXMLParser and got all tags in the didStartElement method and values in the foundCharacters method.

But, I want to get only that tag that is on the screen and after second page tag and so on....

Any idea or suggestion will be helpful to me...

EDIT :
For example if there are three pages of HTML loaded in the webview then only one page is seen on the screen, and then by adding the height of the webview * page, the next page will come on screen but that page was also loaded in the webview, just not seen on screen.

So is there anything that will give me those tags that are on screen. (or whose values are on the screen)?

来源:https://stackoverflow.com/questions/25445210/how-to-get-html-tag-which-seen-in-uiwebview-screen-out-of-all-html-tag-loaded-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!