I'd like to change the color of status bar from white to black by press button, programmatically only in a single-ViewController
This is the code:
- (UIStatusBarStyle)preferredStatusBarStyle {
    NSLog(@"PreferredStatusBarStyle");
    if(nav_bar.alpha==1)
    {
        NSLog(@"->UIStatusBarStyleBlackOpaque");
        return UIStatusBarStyleBlackOpaque;
    }
    else
    {
        NSLog(@"->UIStatusBarStyleLightContent");
        return UIStatusBarStyleLightContent;
    }}
then When I press a button action is:
[self setNeedsStatusBarAppearanceUpdate];
But this doesn't work!
When I press the button log write the correct status according to navbar.alpha, but statusbar text color remain UIStatusBarStyleBlackOpaque like when view appear.
 
     
     
     
     
    