9th Day As An iOS Developer With No Experience

September 15, 2015 - 9th Day As An iOS Developer With No Experience

PAY DAY! Yeah, at 5:30PM I received my very first salary at my new company. It is really good to have a job you really love while you are earning at the same time. I remember this quotation: 

“ Choose a job that you love and you’ll never have to work a day in your life … “

Wow, that’s exactly my thinking since when I was in Company A. Exactly! Exactly! Exactly! However, I really have to finish my project. I have confirmed today to myself, by talking to my colleagues and not directly to my manager, that the 2nd project that I have been working on is REAL! So real! I have to finish it within 10 day. Challenge accepted! I won’t disappoint my bosses. I just have to be cool. Stay Calm and Trust Yourself and Jesus. Amen? :) Amen!

Now, as for the learnings, one of the most significant learning that I got today was setting the status bar of the iPhone to Hidden and Visible by coding it. How can you change the visibility of the status bar programmatically? Follow these steps:

 First, (I am not sure if this is necessary) check the check box named: “Hide Status Bar” under the Deployment Info of your project. How to get there? Simply click your project name located at the left side of your Xcode.

Second, please check this yourself if this one too is necessary, go to your Info.plist. This file is usually stored inside your Supporting Files Folder/Group. Find this one: "View controller-based status bar appearance” and set that to NO. If ever you can’t find it, then add a key.

Next, at the header of your ViewController (the ViewController.h), put this Boolean variable inside your interface, remember to put curly braces okay?

BOOL shouldHideStatusBar;

So your whole codes should be something like this or looks like this:
//  HomeViewController.h
//  Projectxxx
//  Created by dr on 9/14/15.

//  Copyright (c) 2015 dr. All rights reserved.


#import <UIKit/UIKit.h>

@interface HomeViewController : UIViewController
    BOOL shouldHideStatusBar;


Lastly, at your implementation file (the ViewController.m), you need to put a method for setting up the status bar.

- (BOOL)prefersStatusBarHidden {
return shouldHideStatusBar;

and then inside your ViewDidLoad method or whenever you want to set the status bar from, put this block of codes:

    // show again the status bar
    shouldHideStatusBar = NO;
    [self setNeedsStatusBarAppearanceUpdate];

Do you this idea? You are setting your variable boolean at your header to NO. And then you’ll call the method setNeedsStatusBarAppearanceUpdate, this will update the status of your status bar. Okay, does it work? If no, then probably you’re device or your project is targeting the iOS 8 or up.
Put this code blow the code above:
    // ios 8 show again the status bar
   [UIApplication sharedApplication setStatusBarHidden:NO withAnimation:NO];

You just have to change the value of setStatusBarHidden whenever you want to hide or show your status bar. If you have anymore questions or this short tutorial is not clear enough for you, comment below.

Post a Comment