Hiding Status Bar

JSpringJSpring GBUniversity ✭✭

Hi,

I am trying to hide the status bar within a certain View and have overridden PrefersStatusBarHidden and PreferredStatusBarUpdateAnimation as follows:

public override UIStatusBarAnimation PreferredStatusBarUpdateAnimation {
    get {
        return UIStatusBarAnimation.Slide;
    }
}

public override bool PrefersStatusBarHidden ()
{
    return this.statusBarHidden;
}

I am then firing the SetNeedsStatusBarAppearanceUpdate from a private method which also sets the statusBarHiddenProperty in the last method above:

private void toggleStatusBarHiddenWithAppearanceUpdate(bool updateAppearance)
{
    this.statusBarHidden = !this.statusBarHidden;
    if(updateAppearance)
        UIView.Animate (500, () => {
            this.SetNeedsStatusBarAppearanceUpdate ();
        });
}

I have stepped through the code and the private bool statusBarHidden is being set correctly (ie true when was false, and false when was true) and the SetNeedsStatusBarAppearanceUpdate is being stepped into, however the status bar is still there!

Was wondering if anyone could provide some guidance?

Many Thanks!

Best Answer

Answers

  • JSpringJSpring GBUniversity ✭✭

    Thanks @MichaelBluestein - I tried adding in the following to animate the status bar toggle by sliding it in and out:

    public override UIStatusBarAnimation PreferredStatusBarUpdateAnimation {
        get {
            return UIStatusBarAnimation.Slide;
        }
    }
    

    However it is not sliding - wonder if you could provide any advice on that? Thanks again!

Sign In or Register to comment.