mirror of
https://github.com/apache/cordova-plugin-statusbar.git
synced 2025-01-19 09:22:50 +08:00
Merge pull request #83 from lunaru/master
CB-13124: Add option for native scroll-to-top on WebView
This commit is contained in:
commit
4642be07a6
@ -65,6 +65,10 @@ Preferences
|
|||||||
|
|
||||||
<preference name="StatusBarStyle" value="lightcontent" />
|
<preference name="StatusBarStyle" value="lightcontent" />
|
||||||
|
|
||||||
|
- __StatusBarDefaultScrollToTop__ (boolean, defaults to false). On iOS 7, allows the Cordova WebView to use default scroll-to-top behavior. Defaults to false so you can listen to the "statusTap" event (described below) and customize the behavior instead.
|
||||||
|
|
||||||
|
<preference name="StatusBarDefaultScrollToTop" value="false" />
|
||||||
|
|
||||||
### Android Quirks
|
### Android Quirks
|
||||||
The Android 5+ guidelines specify using a different color for the statusbar than your main app color (unlike the uniform statusbar color of many iOS 7+ apps), so you may want to set the statusbar color at runtime instead via `StatusBar.backgroundColorByHexString` or `StatusBar.backgroundColorByName`. One way to do that would be:
|
The Android 5+ guidelines specify using a different color for the statusbar than your main app color (unlike the uniform statusbar color of many iOS 7+ apps), so you may want to set the statusbar color at runtime instead via `StatusBar.backgroundColorByHexString` or `StatusBar.backgroundColorByName`. One way to do that would be:
|
||||||
```js
|
```js
|
||||||
|
@ -138,8 +138,14 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
[self setStatusBarStyle:[self settingForKey:setting]];
|
[self setStatusBarStyle:[self settingForKey:setting]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setting = @"StatusBarDefaultScrollToTop";
|
||||||
|
if ([self settingForKey:setting]) {
|
||||||
|
self.webView.scrollView.scrollsToTop = [(NSNumber*)[self settingForKey:setting] boolValue];
|
||||||
|
} else {
|
||||||
|
self.webView.scrollView.scrollsToTop = NO;
|
||||||
|
}
|
||||||
|
|
||||||
// blank scroll view to intercept status bar taps
|
// blank scroll view to intercept status bar taps
|
||||||
self.webView.scrollView.scrollsToTop = NO;
|
|
||||||
UIScrollView *fakeScrollView = [[UIScrollView alloc] initWithFrame:UIScreen.mainScreen.bounds];
|
UIScrollView *fakeScrollView = [[UIScrollView alloc] initWithFrame:UIScreen.mainScreen.bounds];
|
||||||
fakeScrollView.delegate = self;
|
fakeScrollView.delegate = self;
|
||||||
fakeScrollView.scrollsToTop = YES;
|
fakeScrollView.scrollsToTop = YES;
|
||||||
|
Loading…
Reference in New Issue
Block a user