Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

UIStatusBarStyle does not work in Xamarin.Forms 1.2.3.6257

$
0
0

I want to set status bar style to UIStatusBarStyle.LightContent.

So I added code

UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);

to AppDelegate.FinishedLaunching(UIApplication app, NSDictionary options)

and made a renderer for NavigationPage.

using System;
using MonoTouch.UIKit;
using NavigationApp;
using NavigationApp.iOS.Renderers;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(MainPage), typeof(MainPageRenderer))]
namespace NavigationApp.iOS.Renderers
{
    public class MainPageRenderer : NavigationRenderer
    {
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            NavigationBar.TintColor = UIColor.White;
            NavigationBar.BarTintColor = UIColor.FromRGB(0x81, 0xa9, 0xa8);
            NavigationBar.BarStyle = UIBarStyle.Black;
        }
        public override UIStatusBarStyle PreferredStatusBarStyle()
        {
            return UIStatusBarStyle.LightContent;
        }
    }
}

Finally, I added a key-value pair to info.plist file(Actually, I don't know the meaning of this work exactly... I'm not familiar with iOS dev...)

<key>UIViewControllerBasedStatusBarAppearance</key>
<false />

It works fine in Xamarin.Forms 1.0.6186(source code is here).

But not in Xamarin.Forms 1.2.3.6257(source code is here).

Source code of two version are exactly same. What's the problem and how can I solve it?


Viewing all articles
Browse latest Browse all 58056

Trending Articles