uiscrollview中的uiwebview [英] uiwebview within uiscrollview

查看:43
本文介绍了uiscrollview中的uiwebview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在滚动视图中的uiwebview有问题.在此滚动视图中,顶部有一个标题"视图,而Web视图是底部视图".我正在使用loadHTMLstring方法将数据加载到webview中.我正在尝试做的是,当我缩放时,它应该仅在底部而不是顶部进行放大.这与iPhone上的本机电子邮件应用程序非常相似.我已经在这里住了两天了,没有运气.任何帮助,将不胜感激.预先感谢.

I am having an issue with a uiwebview within a scrollview. In this scrollview, there is a "header" view at top and "bottomview" which is the webview. I am loading the data into the webview using loadHTMLstring method. What I am trying to do is that when I zoom, it should zoom in only on the bottom portion, not the top part. This is very similiar to the native email app on the iphone. I have been at this for 2 days now with no luck. Any help would be appreciated. thanks in advance.

推荐答案

简而言之:您的scrollViewDelegate必须实现viewForZoomingInScrollView并返回webView.

In short : your scrollViewDelegate must implement viewForZoomingInScrollView and return the webView.

详细信息:

将您的scrollViewController设置为scrollView的委托:

Set your scrollViewController as the delegate of the scrollView:

myScrollView.delegate = yourScrollViewController;

在YourScrollViewControllerClass.h中:

In YourScrollViewControllerClass.h :

@interface YourScrollViewControllerClass <UIScrollViewDelegate> {
    [...]
}

在YourScrollViewControllerClass.m中,执行viewForZoomingInScrollView来告知在请求缩放时必须缩放哪个视图:

In YourScrollViewControllerClass.m implement viewForZoomingInScrollView to tell which view must be zoomed when a zoom is asked :

-(UIView *) viewForZoomingInScrollView:(UIScrollView *)scrollViewBis {
    return yourWebView; 
}

这篇关于uiscrollview中的uiwebview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆