0

I am making some changes in an old app that is not be worked on for more then 2 years. I've build and run the app in xCode 6 and got the following result.

enter image description here

For the status bar i'm trying the following:

- (void)viewDidLoad
{
    [super viewDidLoad];
    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
    {
        [self prefersStatusBarHidden];
        [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
    }
    else
    {
        // iOS 6
        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
    }
}

// Add this method
- (BOOL)prefersStatusBarHidden {
    return YES;
}

Also I'm trying to set View controller-based status bar appearance to NO

Can anybody help me with this? I'm not using storyboards and not planning to do with this app. It are all seperated XIB files.

Thanks in advance !

EDIT

After adding this code:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.backgroundColor = [UIColor blackColor];
self.window.clipsToBounds =YES;
self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
}

I get the following: enter image description here

My tabbar is created in code in my appdelegate:

 self.tabBarController = [[UITabBarController alloc] init];
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:homeNavigation,bookNavigation,doctorsNavigation,settingsNavigation,locatorNavigation,nil];

    [self.window makeKeyAndVisible];
Steaphann
  • 2,745
  • 6
  • 47
  • 103

1 Answers1

0

Try this, if you want to start the view controller below the status bar (write this code in viewDidLoad method).

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
{
    self.edgesForExtendedLayout=UIRectEdgeNone;
}

and if you want to hide the status bar follow this link

Community
  • 1
  • 1
Saif
  • 1,778
  • 1
  • 14
  • 32