English 中文(简体)
UIWeb Scrolling
原标题:UIWebView Scrolling

我用“IDWeb”语装上了超文本,因此,我“IDWebView”从中间开始,延伸。 我必须把这一意见从滚动中锁下来,把它放在可以浏览的滚动词上。 网上口号内部浏览。 我试图这样做。

 [[webView.subviews objectAtIndex:0] setScrollEnabled:NO];

but I am not able to stop the webView from scrolling internally when I load a form in it that has textFields clicking on which brings up the keyboard. When I load plaintext, I am able to get the desired behavior. I want to stop the webView from autoscrolling and handle the scrolling myself using the scrollView that lay beneath the webView. It might not make sense to most of you that I am reinventing the wheel but the requirement is such.

Can anybody suggest what to do?

问题回答

You can try,

for (id subview in webView.subviews)

    if ([[subview class] isSubclassOfClass: [UIScrollView class]])

        if([subview respondsToSelector:@selector(setScrollingEnabled:)]) [subview performSelector:@selector(setScrollingEnabled:) withObject:NO];

或你需要停止放弃你可以尝试的网上意见。

for (id subview in webView.subviews)
        if ([[subview class] isSubclassOfClass: [UIScrollView class]])
            ((UIScrollView *)subview).bounces = NO;

Hope this helps.

Try running this after the webview has loaded (i.e. in the proper delegate method):

[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName( body )[0].style.overflow= hidden "]

如果你能够使用超文本,你还可以就身体要素确定正确的风格:

body { overflow: hidden; }

If you do either of these, you need to make sure that you make the UIWebView tall enough to display everything. You can get the height by running this (also after the webview has loaded):

CGFloat height = [webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight"]




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签