I am using the cordova status bar plugin, it works great until I open an inappbrowser or open a camera, after that it overlaps the app.
I have tried following methods:-
<preference name="fullscreen" value="false" />
Add 20px margin, but that only works when the above scenario is encountered, else it shows blank 20px space (Used with cordova plugin)
Try doing the following to restore the hidden overlap:
StatusBar.overlaysWebView(true);
StatusBar.overlaysWebView(false);
i have solved this using this code after camera is closed.
$cordovaStatusbar.overlaysWebView(true);
$cordovaStatusbar.overlaysWebView(false);
Btw, i'm using ngCordova.
EDIT:
This was fixed in the StatusBar plugin
Currently the NPM registry has only the version 2.4.3
of the cordova-plugin-statusbar
. The fixed landed in the Master branch
So basically for ionic people this would mean you need to add it like this (maybe remove it before):
ionic cordova plugin add https://github.com/apache/cordova-plugin-statusbar#master
This installs the master branch from github as plugin for you.
Then run something like this to get it into your Xcode project:
ionic cordova build ios --no-build --prod
Original Post
While calling in JavaScript the method overlaysWebView
with true
and false
works, I assume the proper way would be to call the setNeedsStatusBarAppearanceUpdate
method natively when the view disappears.
CDVCamera.m
https://github.com/apache/cordova-plugin-camera/blob/master/src/ios/CDVCamera.m#L751
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self setNeedsStatusBarAppearanceUpdate];
}
Right now only viewWillAppear
is implemented.
BTW: Maybe someone knows why the hiding transition of the statur bar works with following code (in the viewWillAppear
method):
SEL sel = NSSelectorFromString(@"setNeedsStatusBarAppearanceUpdate");
if ([self respondsToSelector:sel]) {
[self performSelector:sel withObject:nil afterDelay:0];
}
but not with the following:
[self setNeedsStatusBarAppearanceUpdate];
And in the viewWillDisappear
it works only if the afterDelay is left out with the performSelector or the [self setNeedsStatusBarAppearanceUpdate];
is called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With