Cường Nguyễn
Cường Nguyễn

Reputation: 71

Hide Scrollbar in Cordova IOS App

This is not work on my ios cordova app, I have tried many ways, but the scrollbar still appear. ::-webkit-scrollbar { display: none }

This article tell me to add 2 lines to CDVUIWebViewEngine.m file but I dont know where to paste these lines.

self.webView.scrollView.showsVerticalScrollIndicator = NO; self.webView.scrollView.showsHorizontalScrollIndicator = NO;

I need a solution to hide scollbar entire my Cordova Ios App, please help me, thanks.

Upvotes: 3

Views: 944

Answers (1)

Pengcheng Fan
Pengcheng Fan

Reputation: 111

If you are using plugin cordova-plugin-ionic-webview, which is transfer your APP from using UIWebView to WKWebView. After build your APP.

  1. find file platforms/ios/your_APP_name/Plugins/cordova-plugin-ionic-webview/CDVWKWebViewEngine.m;

  2. find lines

wkWebView.configuration.preferences.minimumFontSize = [settings cordovaFloatSettingForKey:@"MinimumFontSize" defaultValue:0.0];
wkWebView.allowsLinkPreview = [settings cordovaBoolSettingForKey:@"AllowLinkPreview" defaultValue:NO];
wkWebView.scrollView.scrollEnabled = [settings cordovaBoolSettingForKey:@"ScrollEnabled" defaultValue:NO];
wkWebView.allowsBackForwardNavigationGestures = [settings cordovaBoolSettingForKey:@"AllowBackForwardNavigationGestures" defaultValue:NO];
  1. insert the two lines under them.
wkWebView.scrollView.showsVerticalScrollIndicator = NO;
wkWebView.scrollView.showsHorizontalScrollIndicator = NO;

It works on iOS 13.

Upvotes: 1

Related Questions