The last Row of TableView in a ContainerView is Hidden Behind TabBar - ios

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.

Related

IQKeyboardManager issue , UIViewController top overlapping status bar

I am using IQKeyboardManager.
I am showing an UITextView in middle of the screen with transparent background when I click 'reply'. The entire viewController moving up, fine. but when I dismissed, the viewController top is under the statusBar.
why is it happening?
That is the behavior of IQKeyboardManager. IQKeyboardManager will take topmost view controller and based on the textView position it will push the whole view controller to up. There is nothing wrong with the library. That is how it's got implemented. So there are few ways to avoid this.
One way to use below line. Try once. I'm not sure this will work for every project.
self.view.window.windowLevel = UIWindowLevelStatusBar;
Another way is to add one more super view for TextView and try. These are few possible ways of handling it.
Try moving those TextFields inside a ScrollView and Navigation Bar (if using custom) out of ScrollView. It will solve this issue.

TableViewController scrolls under status bar

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

Gap Above Bottom Tab Bar - Embedded NavigationController + Embedded TableViewController

This issue has had me stumped for a few days.
This is my relevant storyboard layout:
I have set every layout under the sun to all three View Controllers and still get a resultant Table View with a "gap" above the Banner View - seemingly the same height as the Banner View. As follows:
One thing that did work was to drag the Container View over the bottom Banner View like this:
And the result renders perfectly on my test device as well as every simulator - i.e. no gap.
But such a solution is essentially a hack of sorts and I'd like to see if there is anything I can do to properly fix the issue.
For the record, I have tried every option in the IB - adjust scroll view insets, extend edges under top/bottom bars, etc... as well as various code snippets I have googled here and there. Nothing seems to solve the issue for me.
I managed to solve the gap at the top of the table view under the nav bar (seemingly a common issue with a lot of content out there). But there does not seem to be so many cases like mine above.
Any help or indications are greatly appreciated. Thank you people :-)
* ADDITIONAL INFORMATION *
As per a comment below, I add the constraints I have tried for the said container:
I had similar gap problem, when used ContainerView to embed StoryboardReference - to support StoryboardReference from UITabBarController on iOS8.
I have resolved this by turning on Extended Egdes -> Under OpaqueBars checkbox on view controller with container view, like on image:
The red UIView is ContainerView, first ViewController in StoryboardReference is UINavigationController.
OK. Essentially, with the kind assistant of #beyowulf I realised my current setup had to be changed.
I was
unnecessarily using a container view in your tabbarcontroller
as he correctly indicated
there is no way for your table view controller to infer it's in a
tabbarviewcontroller.
In order for my table view controller to be flush with the bottom of the container view, I had to
directly embed your navigation controller in your tabbarviewcontroller
and adjust the bottom inset of your table view.
I did this via the top menu bar items:
Select the TableViewController
Editor > Embed in - - - > Tab Bar Controller.
You can easily incorporate a navigation controller into the storyboard thereafter if you wish to do so, which I did also.
A handy tip and one I followed to solve my 'gap' issue appearing above the bottom tab bar.
Hope this helps anyone who might also be facing the same issue.
Thanks again to #beyowulf.

Swift Two Tab Bars shown and not sure why?

Does anybody know why I might have these stacked tab bar?
I don't see where this would be in any of my view controllers and what code i would even look for. If guidance on what would even generate this would help. It's a fixed bar on the bottom and I'm trying to remove it. I am not sure when it started to show up here anyways. It serves no purpose for me. It also shows up on each of the tabs when I click on each of them.
You are using a searchBar, if you want just one bar you would have to move the searchBar to the top of the screen
hope this helps
I ended up figuring out what I did wrong. At some point, I clicked "shows toolbar" in the navigation controller that was embedded in the tab view controller. When I unchecked this the second toolbar went away.
Thanks for everyones help.

Navigationbar not visible during runtime

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...

Resources