iOS 7 Status Bar Empty Space - ios

I have an issue where a white space is being created where I think my app thinks it needs a status bar.
I have a UIViewController, embedded in that is a UITabBarController. The UITabBarController then just displays UIViewControllers as normal.
When the app first loads (iPad iOS 7), everything works as expected, only inside that UITabBarController, the UIViewController (displayed by the UITabBarController) is offset downwards by 20 pixels. The space for a UIStatusBar.
When I say offset, the UIViewController doesn't fall off the bottom of the screen, it just gets shorter to add that 20 pixel space.
This started happening after I enabled the status bar in my Info.plist with View controller-based status bar appearance = YES.
The app only does this when it initially loads. After I change the tab to show a different UIViewController, the space disappears.
Any ideas why this is happening and how I can stop this? Thanks.

I can't comment yet, but wasn't there a warning, when you tried to place a tabbarController inside of a navigationController? Last time I tried this, XCode threw some warnings regarding the order.

Related

Increasing UINavigationController navigation bar height in Landscape mode

I have seen too many posts on this but unable to find satisfactory answer to this question. Specifically, I want to increase the height of navigation bar of UINavigationController by around 20 pts when iPhone is in landscape mode (not otherwise), and also set a custom image for it's Background. What I have found so far:
Manipulating frame of UINavigationBar managed by navigation controller,
Hacks such as sizeThatFits along with subclassing UINavigationController -- doesn't work for me in iOS 12 and also it is a kind of hack,
Hide the default navigation bar in UINavigationController and instead replace it with a custom navigation bar. But I don't see any sample code. Any sample code will be appreciated.
Edit: Here is how I want my custom navigation bar to look like that works across UINavigation hierarchy.

UIViewController in UITabBarController is Black

I have a UITabBarController with 3 tabs. One of the UIViewControllers, which controls one of the tabs, is a UITableViewDelegate and has an embedded UITableView which uses a portion of the screen. There are some buttons that appear below the UITableView.
This UIViewController generally works, but if I make changes to the code (could be in any file), sometimes this UIViewController will display nothing but black between the Navigation Bar and the Tab Bar. I can switch to other tabs and they act as expected.
Even stranger, if I go to the Storyboard and change the order of the tabs, then the problematic UIViewController starts working again. All I am doing is changing the order of the tabs ...
Any ideas about what is going on here?
I'm no expert on swift, but I've spent lots of time with tab bars and UITableViews inside of UIViewControllers. Here are things that I would check/do:
reset my simulator (run it, and use the simulator menus)
clean my build area
change the table view background color to red
change the table view tintColor to green
change the outermost view background color to yellow
change the outermost view tintColor to blue
now when it goes black, maybe it will show another color
check, and double check the constraints on the table view
the blackness might be caused by no cells getting displayed, or by the whole table view losing its sizes somehow

Navigation controller view offsetting on status bar hide on iOS 7

Weird iOS 7 issue I am having.
I have a UINavigationController added as a child view controller to my main view controller.
When I hide the status bar (by setting preferredStatusBarHidden and calling setNeedsStatusBarAppearanceUpdate), the navigation controllers top view controller recesses the 20 pixels that the status bar did, but not the UINavigationBar. This is only happening on iOS 7 - and I cannotfind a work around. If I rotate the device, it corrects the issue?
Before I hide the status bar
After I hide the status bar
I have tried calling layoutIfNeeded and updateViewConstraints. These did nothing. Was able to do conditional checks for version number and add constraints to fix, but this breaks things worse on rotate and I would prefer a cleaner solution if anyone has any ideas.
Thanks.

iOS 7 Translucent Tab Bar and Nav Bar

I am having an issue with the translucent UINavigationBar and UITabBar in iOS 7, whereby if I only have the UINavigationBar translucent it works as I would expect it to, however as soon as set the UITabBar to translucent I get a strange effect happening in one out the four tabs in the app. Let my explain with some images:
This image shows the interface where only the nav bar is set to translucent:
With this image showing the result of the user scrolling the content up and under the nav bar:
Now, this is how I would expect it to look, and when the user scrolls the content back from under the nav bar it looks as it did before. However if I also set the UINavigationBar to translucent, and scroll the content to under the nav bar, the result is different to the second image:
Event the tab bar doesn't look right to me. This next image shows that the look of the nav bar if now different to what it was before, when the content is scrolled back from underneath it:
Again, I also don't thing that the look of the tab bar is correct, as the next image shows a different tab with content underneath it, with only a subtle change to the look of the tab bar:
Has anyone else had similar issues to this? (This is all set up in a storyboard)
Well, this was an annoying one. I added a fifth tab which had a MKMapView in it. On running the app and selecting the fifth tab, the tint colour from the nav and tab bars was removed, so I did a search and came across MKMapView affecting UINavigationBar and UITabBar
The test device I was using had iOS 7.0.2 on it, which falls in line with the bug mentioned; so have therefore updated it to the 7.1, and low and behold everything looks as it should.

UISplitView with UITabbar

I have a strange one that I can not seem to fix. I am currently working on updating my app to iOS7. This all worked in iOS6. It is an universal app and thus uses same xib files. However the iPad uses UISplitViews on some. Like I said, this all worked in iOS6 oh this all works on the iPhone too.
The problem is a grey bar at the bottom. I changed the tab bar to be opaque to move views up properly as i had some UI clipped to bottom of views and that went underneath the tab bar, sidetracked there. But if i set it back to translucent bar, it goes underneath but stretched properly. if i dont, it adds a bar. Other tabs work fine when NOT using splitview.
The UISplitviewController is added programmatically.
See attached image for better description.
This I have tried:
Added autoresize on splitview
Checked xib for subviews in the splitviews to have auto resize
Tried to force splitview to be screen bounds
Removed clips to bounds on all views
Removed autoresize subviews
Any ideas would be welcomed.
Thank you all.
UPDATE:
setting the background colour the uisplitview, it does colour the bar black. So the uisplitview is definitely stretching to it.
I subclassed UISplitViewController and added the line below to viewDidLoad and that fixed the grey line.
self.extendedLayoutIncludesOpaqueBars = YES;
I believe I have found an alternative solution for you. I have had the exact same problem, mostly because we are both doing something against Apple's Guidelines which is having a SplitViewController nested within a Tabbar controller (SplitView should be the root view). This was okay in iOS 5/6, but now in iOS 7 there are far too many side effects to achieve this.
The reason you see your view stretch completely when you set the bar to be translucent is because the bar is NOT taken into account when drawing the view. When you set translucent to false, it is then taken into account of the view and you will see that grey bar there because that's your view pretending there's a tabbar at the bottom of the screen.
And as always, a SplitViewcontroller's height cannot be changed, as it is determined by the visible window height.
I tried everything you did and then some. The real solution came from using a third-party Split View Controller.
I recommend switching over to https://github.com/mattgemmell/MGSplitViewController . This split view controller is actually one large View with container views living inside of it. Because of this, you avoid all the side effects of putting an actual split view controller within a tab bar.
If that doesn't float your boat, you could create your own solution which follows the same idea of having one UIViewController with two container views contained in it, though the people behind MGSplitViewController did a good job of that already.
This was the only way I was able to solve this issue, let me know if you find an alternative.
Instead of creating a subclass for UISplitViewController, I just added this code on my master's viewDidLoad:
self.splitViewController?.extendedLayoutIncludesOpaqueBars = true
For the controller that is the detail view of UISplitViewController you just do this:
-(UITabBarController*)tabBarController{
return nil;
}

Resources