Saturday, 17 January 2015

Xamarin Forms – A light status bar for iOS

I’m writing an app in Xamarin Forms at the moment and as part of that I want to have a light on dark theme rather than the dark on light default. Ultimately there will be a background image on the pages that extends into the navigation area at the top of the screen, but for now a coloured backgound will do. This post will show how to accomplish this.

I started with a simple Xamarin Forms app and set the BackgroundColor of the content page to Green, here’s what I got…

Screen Shot 2015-01-17 at 10.26.28

That status bar isn’t much good is it? To alter it you need to do two things…

  • Alter the info.plist file and set the Status Bar Style to LightContent
  • Add an additional item to the .plist file

Open info.plist and scroll down to the following section…

Screen Shot 2015-01-17 at 10.27.07

You may or may not want a status bar whilst the app is starting up – if not then check “Hide during application launch”.

Next, at the bottom of the plist editor there’s three tabs, click on Source and then add in the following…

Screen Shot 2015-01-17 at 10.27.42When you click “Add New Entry” you can then select “View controller-based status bar appearance” from the dropdown, then click/tab off it and it’ll change the type column to Boolean. The default is Yes, you need to set it to No.

With that done, rebuild your app and run it and voila, you get this…

Screen Shot 2015-01-17 at 10.28.18

Looking good! But that’s not the end of the story – what happens when you add a navigation bar to the app? Ah, well – you get this…

Screen Shot 2015-01-17 at 10.29.52

That’s with the following code in my App.cs file…

public class App
{
    public static Page GetMainPage ()
    {   
        var mainPage = new MainPage ();
        var navPage = new NavigationPage (mainPage);
        navPage.BarBackgroundColor = Color.Green;
        return navPage;
    }
}

And if I happen to set a title on my content page it shows as follows…

Screen Shot 2015-01-17 at 10.57.05

Now at this point in my travels around the intertubes I found a bunch of articles that stated I should override some method of the view and explicitly state that I wanted a light status bar. I spent a load of time on this but all to no avail, so I went back to the original code and had a poke around and what did I find but the BarTextColor property. Setting that had the desired effect…

Screen Shot 2015-01-17 at 10.57.44

The code is now as follows…

public class App
{
    public static Page GetMainPage ()
    {   
        var mainPage = new MainPage ();
        var navPage = new NavigationPage (mainPage);
        navPage.BarBackgroundColor = Color.Green;
        navPage.BarTextColor = Color.White;
        return navPage;
    }
}

I hope that helps someone as there seems to be a lot of misinformation on the intertubes about how to get this to work. I’m on the latest Xamarin Forms build, as of today that’s 1.3.1.6296.

227 comments:

«Oldest   ‹Older   201 – 227 of 227
Sam Smith said...

Hello there, great stuff you’ve shared here I will be checking regularly for more articles. But wait! When it becomes hard to manage your online assignment, availing Online Assignment Help is the best choice. Many students often fail to submit their assignment before deadlines and end up scoring low grades because they didn’t have enough time to write the assignment given on time and satisfactorily. Visit Assignment Help . for assistance.

CloudLearn ERP said...

Your article has piqued my interest. This is definitely a thinker's article with great content and interesting viewpoints. I agree in part with a lot of this content. Thank you for sharing this informational material.
Best Data Science training in Mumbai

Data Science training in Mumbai

CloudLearn ERP said...

I thought I was strong with my ideas on this, but with your writing expertise you have managed to convert my beliefs your new ideas. Mallorca is fun
Best Data Science training in Mumbai

Data Science training in Mumbai

ek said...

I am genuinely thankful to the holder of this web page who has shared this wonderful paragraph at at this place
Courses in Digital Marketing in Pune

Unknown said...

python course in coimbatore
python training in coimbatore
java course in coimbatore
java training in coimbatore
android course in coimbatore
android training in coimbatore
php course in coimbatore
php training in coimbatore
digital marketing course in coimbatore
digital marketing training in coimbatore
software testing course in coimbatore
software testing training in coimbatore


Caleb said...

What an amazing blog! Tell you what I have bookmarked for regular reading. Your baby is indeed absolutely beautiful, one of the sweetest tiny infants ever born, but they need your care a lot. We know that not everyone has time to find, research, and compare air purifiers from a huge market available. Visit Air Purifier for Baby.

assignmentauthors said...


At first an Oracle team leader and magento developer must meet and agree on the way forward after being requested by the system administrator representing the university to develop the system.
assignment expert

Silvia said...

Thank you for this wonderful article also learnt that meat slicer makes cutting meat moreover as foods like cheese, fruits, and others, more efficient than ever. This small tool which will easily fit on your counter and will perform in seconds what can take you hours within the kitchen to accomplish from Best Meat Slicer under $300

Janu said...

Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way. T hank you so much.




Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery











Ian said...

What a wonderful piece of article I have bookmarked for future checkup. If you are a student and you are interested in designing, developing, producing, operating, and using aircraft, chances are that you are pursuing an aviation course. In most academic institutions, in order for you to graduate in this course, then you must prepare a capstone project. One is supposed to apply the skills taught in this class when writing a capstone paper. Learn more on Aviation Capstone Writing Help .

Yamuna said...

python course in coimbatore
java course in coimbatore
python training in coimbatore
java training in coimbatore
php course in coimbatore
php training in coimbatore
android course in coimbatore
android training in coimbatore
datascience course in coimbatore
datascience training in coimbatore
ethical hacking course in coimbatore
ethical hacking training in coimbatore
artificial intelligence course in coimbatore
artificial intelligence training in coimbatore
digital marketing course in coimbatore
digital marketing training in coimbatore
embedded system course in coimbatore
embeddedsystem training in coimbatore
internship training in coimbatore
inplant training in coimbatore

saran said...

Impressive! I finally found great post here. Nice article on data science . It's really a nice experience to read your post. Thanks for sharing your innovative ideas to our vision.
Digital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery

deiva said...

Good post. I learn something new and challenging on sites I stumbleupon on a daily basis. It's always interesting to read content from other writers and practice a little something from their web sites.
Digital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery

subha said...

Hi, I do think this is a great website. I stumbledupon it ;) I am going to come back once again since i have saved as a favorite it. share more.
Ai & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai

websoft said...

Good information and, keep sharing like this. top college in british columbia

subha said...

Such a wonderful article and I feel that it is best to write more on this topic. Thank you so much because i learn a lot of ideas about it. Keep posting... good luck.
Ai & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai

Village Talkies said...

Best Corporate Video Production Company in Bangalore and top Explainer Video Company in Bangalore , 3d, 2d Animation Video Makers in Chennai.
Some excellent tips in here

Anirban Ghosh said...

Writing, like great art requires much more than knowledge and education. A great writer is born as opposed to ""made"" and you are a great writer. This is excellent content and interesting information. Thank you.SAP training in Kolkata
SAP training Kolkata
Best SAP training in Kolkata
SAP course in Kolkata
SAP training institute Kolkata


Emily said...

Thanks for the post. By the way, if you need help with your nursing school assignment, you may visit Mike Nursing Service which provides a good assistant. Here you may also find nursing career goals essay examples and other useful articles.

Emily said...

If you've faced difficulties with essay writng and uncover synonym, visitr Mike Nursing Essay, where you will find enough useful tips for yourself.

Janu said...

Nice! you are sharing such helpful and easy to understandable blog. i have no words for say i just say thanks because it is helpful for me.

Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery


pratheep said...

Thanks a lot very much for the high your blog post quality and results-oriented help. I won’t think twice to endorse to anybody who wants and needs support about this area.

Robotic Process Automation (RPA) Training in Chennai | Robotic Process Automation (RPA) Training in anna nagar | Robotic Process Automation (RPA) Training in omr | Robotic Process Automation (RPA) Training in porur | Robotic Process Automation (RPA) Training in tambaram | Robotic Process Automation (RPA) Training in velachery

pratheep said...

Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.

Robotic Process Automation (RPA) Training in Chennai | Robotic Process Automation (RPA) Training in anna nagar | Robotic Process Automation (RPA) Training in omr | Robotic Process Automation (RPA) Training in porur | Robotic Process Automation (RPA) Training in tambaram | Robotic Process Automation (RPA) Training in velachery

Term Paper Writing Services said...

Online law research paper help services are very common nowadays since there are very many students seeking Law Research Writing Services and law essay writing services.

Emily said...

Great post, thank you. There are many writing services on the web, but if you are working on nursing essay for college or university - click here and get a high-quality assistance from professional writers.

Sam Smith said...

Great content comes from great writers. I appreciate your art of delivering content. GIS (Geographical Information System) are basically systems of computers that are designed to collect, analyze, manage and share geographical and spatial data. Remarkably, almost all environmental applications today utilize GIS. Read more on GIS Assignment Help

vimala said...
This comment has been removed by the author.
«Oldest ‹Older   201 – 227 of 227   Newer› Newest»