I am having an i开发者_StackOverflow社区ssue 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.
In short : your scrollViewDelegate must implement viewForZoomingInScrollView and return the webView.
In details :
Set your scrollViewController as the delegate of the scrollView:
myScrollView.delegate = yourScrollViewController;
In YourScrollViewControllerClass.h :
@interface YourScrollViewControllerClass <UIScrollViewDelegate> {
[...]
}
In YourScrollViewControllerClass.m implement viewForZoomingInScrollView to tell which view must be zoomed when a zoom is asked :
-(UIView *) viewForZoomingInScrollView:(UIScrollView *)scrollViewBis {
return yourWebView;
}
精彩评论