0

So I know that in my ViewController.m I can override my

-(UIStatusBarStyle) preferredStatusBarStyle

method to change the return of the preferredStatusBarStyle. But here's the thing: I have a property

@property UIStatusBarStyle *customPreferredStatusBarStyle

and I'm changing the value of customPreferredStatusBarStyle in this bridge block:

[_bridge registerHandler:@"setStatusBarHandler_iOS" handler:^(id data, WVJBResponseCallback responseCallback) {
_customPreferredStatusBarStyle = UIStatusBarStyleDefault;
}]

which means if the website calls the bridge I'll change its value. But I found out that **-(UIStatusBarStyle) preferredStatusBarStyle** method only gets called once when the ViewController is initiated.

Is there any way for me to change my status bar style after the the bridge gets called?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Allen
  • 189
  • 2
  • 11

2 Answers2

4

Just call:

Obj-C

[self setNeedsStatusBarAppearanceUpdate];

Swift

setNeedsStatusBarAppearanceUpdate()
Sean Lintern
  • 3,103
  • 22
  • 28
  • So by calling this method my `-(UIStatusBarStyle) preferredStatusBarStyle` will get called again? – Allen Apr 29 '16 at 13:38
1

In your case I think you can call setNeedsStatusBarAppearanceUpdate() to trigger an update to status bar update.

tx2
  • 724
  • 13
  • 26