1
votes

For some screens status bar text color is white but for some screens it is black,So how to change it to white for all for ios7. I had use PreferedStatusBarStyle() method but it is not executing.

1

1 Answers

1
votes

Just to be sure, PreferedStatusBarStyle() is not a method you call, but a method you have to override.

public partial class MyViewController : UIViewController
{
    public override UIStatusBarStyle PreferredStatusBarStyle ()
    {
        return UIStatusBarStyle.LightContent;
    }
}

Now, this only works for top-level view controllers (or the like, as a VC pushed in a UINavigationController). If you want a sub view controller to drive the status bar, override ChildViewControllerForStatusBarStyle

public partial class TopLevelViewController : UIViewController
{
    public override UIViewController ChildViewControllerForStatusBarStyle ()
    {
        return myNestedViewController.
    }
}

To be exhaustive, if the BarStyle has changed, make sure you let that fact known by calling SetNeedsStatusBarAppearanceUpdate ().

Hope it helps.