Search code examples
ios7uinavigationbarxcode6statusbaruistatusbar

Issue with Status bar in UITableViewController (SidebarController)


I am using UITableViewController in sidebar and I am having status bar as white in my application. I am using a SidebarDemo Library with SWRevealViewController in my application. Everything is working fine, only my issue is when I open my Sidebar , it show white space on top, that is little weired in the application and mentioned in screenshot below.Status bar issue

I tried hiding my status bar by code below

 [[UIApplication sharedApplication] setStatusBarHidden:YES];

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

//    self.edgesForExtendedLayout=UIRectEdgeNone;
//    self.extendedLayoutIncludesOpaqueBars=NO;
//    self.automaticallyAdjustsScrollViewInsets=NO;

    //self.tableView.contentInset = UIEdgeInsetsMake(20.0f, 20.0f, 0.0f, 0.0f);

    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectZero];

    self.tableView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0);
    self.tableView.contentOffset = CGPointMake(0, -20);

But tableView is not moving up. My Sidebar Class having heading of Profile in TableView is inherited from UITableViewController. Please advice how to resolve this issue.


Solution

  • I have used this Sidebar Demo app as well. I had some issues with this SideBarViewController. I fixed those issues. In your case first of all try to change the tintColor of the status bar in the MainViewController.

    _sidebarButton.tintColor = [UIColor colorWithRed:94.0f/255.0f green:48.0f/255.0f blue:19.0f/255.0f alpha:1.0f];
    

    By Default it would be like this

    _sidebarButton.tintColor = [UIColor colorWithWhite:0.1f alpha:0.9f];
    

    AND

    You can also change the SideBarViewController from UITableViewController to UIViewController and implement the UITableViewDelegates in the SideBarViewController and do all the customization to the View in Storyboard. This is what I did to the fix the issues I had.

    Lemme know if I could help you with this SideBar Demo app code.