diff --git a/src/ios/CDVStatusBar.m b/src/ios/CDVStatusBar.m index 3e788b8b..19a13bbd 100644 --- a/src/ios/CDVStatusBar.m +++ b/src/ios/CDVStatusBar.m @@ -143,9 +143,9 @@ - (void)pluginInitialize setting = @"StatusBarDefaultScrollToTop"; if ([self settingForKey:setting]) { - self.webView.scrollView.scrollsToTop = [(NSNumber*)[self settingForKey:setting] boolValue]; + [self webViewScrollView].scrollsToTop = [(NSNumber*)[self settingForKey:setting] boolValue]; } else { - self.webView.scrollView.scrollsToTop = NO; + [self webViewScrollView].scrollsToTop = NO; } // blank scroll view to intercept status bar taps @@ -462,6 +462,17 @@ - (void) dealloc [[NSNotificationCenter defaultCenter]removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; } +- (UIScrollView *)webViewScrollView +{ + SEL scrollViewSelector = NSSelectorFromString(@"scrollView"); + + if ([self.webView respondsToSelector:scrollViewSelector]) { + return ((id (*)(id, SEL))objc_msgSend)(self.webView, scrollViewSelector); + } + + return nil; +} + #pragma mark - UIScrollViewDelegate