Thursday, April 19, 2012

Disabling native iOS vertical window movement in phonegapp application

When we are developing phonegap application page moves up and down when we scroll in the webview eventhough page has little data.
- (void)webViewDidFinishLoad:(UIWebView *)theWebView 
    { 
              for(id subview in theWebView.subviews) { 
              if([[subview class]isSubclassOfClass:[UIScrollView class]]) 
              ((UIScrollView *)subview).bounces = NO; 

    } 
Just add above extra code in appdelegates.m file webviewdidfinish load function.


This will fix the issue.

1 comment:

Anonymous said...

[[subview class]isSubclassOfClass:[UIScrollView class]]

should be written as

[subview isKindOfClass:[UIScrollView class]]