0

I am using a scrollView, in which i have added some static content in a container view and below this container view i have added a web view and added both these views into my scrollView, I dont want the web view to be scroll, instead I want that my scrollview should scroll according to the height of my container view and height of contents in web view.

Note: I am loading contents in webview as html string, that i am receiving from server, The contents are coming in between of html tags and i am then passing this as a string to web view.

Thanks

york
  • 149
  • 1
  • 11

3 Answers3

4

try this code

  CGRect contentRect = CGRectZero;

  for (UIView *subview in scrollview.subviews ) {
    contentRect = CGRectUnion(contentRect,subview.frame);
  }

  scrollview.contentSize = CGSizeMake(scrollview.bounds.size.width, CGRectGetMaxY(contentRect));
Bhupesh
  • 2,310
  • 13
  • 33
0

set scrollview Content Size as containerview height + webview height

and your webview Height must be equal to the content Size of that Webview because you don't want to scroll your webview.

0
  1. find height of contents in webview
  2. make it the size of webview,containerview frame and scrollview contentsize
  3. disable scroll of webview
Community
  • 1
  • 1
Lithu T.V
  • 19,955
  • 12
  • 56
  • 101