Agh, it seems iOS7 has changed the way we use the navigation bars are status bar.
I have a UINavigationController with one view (UITableView) as my root view controller. In the IB I can see the nag bar and the title. When I run the app - the navigation bar is not there and my cells overlap in the status bar.
Can someone tell me whats going on?
Many thanks!
So I found the solution to the problem. Incase anyone else has this issue. I was loading the UITableView controller directly in code. I used a StoryboardID on the UITableViewController and not the UINavigationController. As soon as I changed it - everything worked as per normal.
Silly little things...
Related
I’m working on a project in Xcode 9.1 and a very strange problem occurs with my Table View Controller.
I need to have a table view with static cells and Xcode tells me that I can achieve this only with a TableViewController (doesn’t work with a TableView in a ViewController. Gives me errors).
I’ve embedded my TableViewController inside a Navigation Controller, but when I run the project, the table View scrolls and it’s visible under the status bar (on every iPhone, from X to SE).
I wanted to make the status bar opaque but didn’t find a way to do it.
Am I doing something wrong?
My steps are:
1) Dragged a TableViewController on the storyboard
2) Embed the TableViewController into a Navigation Bar (I’ve tried also to drag the Navigation Bar directly and it comes already connected to a TableViewController).
3) Set the Cells to Static
4) Run on device or simulator.
Screenshot of my problem
Solved it!
The problem was the code I wrote to hide the navigation bar hairline (the 1px line under the bar).
Commenting the code make everything work fine.
To fix your issue I think your Navigation Bar is set to hidden.
1. In your storyboard click on the navigationBar in the navigation controller.
2. Then look for the attributes section "Drawing"
3. Check to see if hidden is true.
4. If it is uncheck it.
My setup has it set to false as default.
to hide navigation you need to write below code in viewDidLoad
self.navigationController?.isNavigationBarHidden = true
I'm struggling to manage the status bar since I placed a Navigation Controller.
When my intro navigation flow passes only through ViewControllers it worked smoothly.
Now I put a Navigation controller in front of my introVC and the frame is shifted down by the size of the status bar as shown in the images linked below.
Now how it looks like :
I cannot understand how to solve it, can you please give me some advice?
Here my Storybord :
Michele
Have you embed your introVC into a Navigation controller or how did you connect those two?
I'm presenting a UITableView modally to provide access to some application settings. When the modal view (root view controller) appears, it has a navigation bar like I expect. However, when one of the options is selected and the next 'UITableView` is popped to the top of the stack, there's no navigation bar.
Here's what one of the child UITableViews looks like:
As far as I know, the two children views should have navigation bars without me having to do anything because they're embedded in a UINavigationController.
I tried dragging a navigation bar to the views but IB will only let me put them inside the UITableView and if I do that, they do appear, but they also go too high in the view and run into the status bar and I can set any layout constraints on them to fix this.
I've scoured the Apple documentation with no luck and found many thread on SO that very, very old and in objective-C.
Can I make these views work together like I'd expect them to or am I going to have to build the child views from scratch?
UPDATE: I'm still trying to get this to work. I've now tried to create a new view controller from scratch. Here's what the view hierarchy looks like:
And you can see in the Storyboard something's not right:
And when I run this in the simulator, I get a new error:
"[UITableViewController loadView] instantiated view controller with identifier "UIViewController-cDg-wV-aMN" from storyboard "Main", but didn't get a UITableView.' But I created the segue by Ctrl-dragging from the cell in the root VC directly to the Table View.
To sum this all up, here's the flow I'm trying to achieve: UIViewController (initial VC) -> UINavigationController (presented modally from the bottom) -> UITableViewController (presented from right to left and with standard navigation bar).
My segues are all set to Show (e.g. Push)
Any help or suggestions would really be appreciated.
Well, I figured out how to fix the problem I was having after coming across another thread that wasn't about the same problem, but it had some advice that tipped me off.
The problem was caused by me creating the segues from the UITableViewCell on my Settings view controller to each of the child UITableViewControllers.
To fix the problem, I simply created the segues between the Settings UITableViewController and each of the child UITableViewControllers.
Hope this helps somebody else someday.
The problem is simple, the Profile viewController has a NavigationBar just under the status bar. I push another viewController on top of the current one. This new viewController hides the status bar.
When I go back USING A SWIPE BACK GESTURE to the Profile viewController, the navigationBar has moved up by the size of the status bar height.
The related question is UINavigationBar moving under status bar when another viewController hides status bar
Any ideas?
Actually,
in that case too, using the following also works.
[[UIApplication sharedApplication] setStatusBarHidden:NO];
Calling this in viewWillDisappear of the second view controller solves the issue.
The main View controller contains a main view and I add a tableView in within the view (the blue-ish color on the screenshot is the header of the tableview).
Somehow, this composition doesn't layout really well... I have no idea why.
Somebody wrote that to avoid this kind of layout issues, using a scrollView as a container makes the trick but I can't add tableViews to a scrollView...
If anybody has an explanation about why this layout problem happens, I'd be happy about it.
Building an app that has tabbar. One of the tab, I need to use container view because I'm switching between three table view. That switching works well, so I will not show you those code to be clear. However, those tables are hidden behind tabbar. Like:
I'm using storyboard and the container view is such that:
So here I put intentionally container to the top of tabbar, because I don't want overlapping. Then with using these codes, I thought that would help me to find the bound of container and set it to the tableView:
The code line vc.view.frame = self.contentView.bounds; is what I'm telling. But that doesn't work at all, clearly, since table is still behind the tabbar.
There are solutions I found on internet, such as setting consentInsent of tableView in viewDidLoad, unchecking some properties of tabbar and making tabbar opaque. None of those worked. The reason I'm asking it this basically. I had to because I can't find a solution worked for my case.
Hope you can see the problem and help me to figure it out.
Please ask me if you need more information / explanation.
Any suggestions would be appreciated.
Thanks!
Try unchecking the under bottom bar property of the view controller from storyboard. If it doesn't work also uncheck the Adjust ScrollView Inset property over there.
Also you must be sure that bottom Layout constraint must be set to Bottom Layout Guide instead of superview.
where tab bar is not show set constraint as follows
Please try to set constraint like this, I hope it will help you.
I had a similar problem but without a table view and with Swift. Anyway my view got hidden behind my tab bar.
if let tabBarController = tabBarController {
tabBarController.tabBar.isTranslucent = false
}
Using this in my UIViewController which is shown by the UITabBarController solved the issue for me. I had the same problem with the navigation bar which is why I found the answer here but it also worked for the tab bar.