Table view cell is overlapped by navigator bar - swift

I have embedded navigation controller and created a table view controller. I have problem when running this in simulator. The top of table view cell is hidden by navigation bar. However, it works well after I go to next page and return back.

Try with this
tableView.contentInset = UIEdgeInsetsMake(44,0,0,0);
Hope it helps

Related

Unintentional lose of a Navigation Bar

I have a UITableView which has a navigation bar that can seque to a View Controller of my app via a UINagivationController. The Table View is editable, where I can delete a cell.
I have found what I think is a bug. When I swipe from left to right the tableview goes away to reveal the view Controller. However, if I only half commit to the swipe and only go 3/4 of the way (not fully going to the View Controller) and return back to the Table View, the navigation bar is removed. I have programmatically removed the navigation bar of the view controller, but I have not removed it from Table View Controller. It is incredibly important for my table view to have the navigation bar, as it is the only way that I can return to the view controller (once the navigation bar is gone, it no longer allows for me to segue back to the View Controller by using the left to right swipe for some reason).
Has anyone seen this problem? Is there code that I need to add to ensure that the Navigation bar does not disappear?
I solved this problem by removing the ability of the pop gesture recogniser using this code in the viewDidLoad( ): self.navigationController?.interactivePopGestureRecognizer?.enabled = false

Navigation Bar is displaying at the bottom

as you can see from the picture i have added, my navigation bar is displaying at the bottom of the screen under my table view. I have just dragged and dropped my navigation bar on to that view controller which means i'm not using a navigation controller. I don't understand why this is happening and i'm sure its a simple fix which i am missing.
image 2 is the storyboard view
image 3 view of the app running
Any help is much appreciated, Thanks!
Delete your old navigation bar
Select your TableViewController and on top click editor->Embed in-> Navigation Controller
Now you should have a navigation bar on top.
See screenshot. You dragged a navigation bar into your table. To achieve the behavior you want you can embed your view controller inside a UINavigationController and access your navigation bar via self.navigationController.navigationBar.
I got your problem
What you have done is you have taken your navigation bar inside tableview...
that is the problem..
you just dragged that navigation bar outside that tableview...and that's it..

UISearchBar displays in the root view but not in any other view on the tab bar

I have implemented the search bar for the table in the first tab and this works fine and filters fine, however, with the same code and the xib linked up all the same etc on the second tab it no longer displays the search bar. Is there a simple reason to this?
Separate out the UISearchBar into its own class and then call it from the multiple views. It is not meant to be reinstantiated for each view controller.
Yes, there is a simple reason—the search bar is a subview of your main view, so when that view gets swiped off screen, it disappears with that view. To fix this, you'll have to add the search bar to the view that holds your tab bar controller—you'll probably have to put it in MainWindow.xib. You can still connect it to your tab bar controller if you need to—just add a reference to in the XIB.

Add a background image to tables in a navigation view in a tabbed application

I have a tabbed application which then has a navigation controller. In each the navigation controller I an a table View Controller which obviously contains a table. I push a new table view controller from this one.
I want to put a background to the table but can only add an image infront of the table. I think this may be because I am adding the sub view in the table view controller, but I don't seem to be able to add it anywhere else.
Please could you help me, thanks.
Try setting UITableView.backgroundView to say UIImageView of your choice and if that's not helping you too much, try setting the UITableViewCell.backgroundView for each of your cell to something similar. As far as I remember the UITableViewCell is opaque and the UITableView is not necessarily seen under it.
I have used a view controller to add the uiimage view then the table view controller view too. This gets the desired visual result, but the table is no longer in the navigation stack so when you clikc on the cell it doesn't push the nav controller.
Is there a way to talk between the table view controller and its view controller?

Last row in UITableView is obscured by UITabBar

I have a UITabBarController that has a list of UINavigationControllers assigned to the 'viewControllers' property.
Each UINavigationController has a custom UIViewController as its 'rootController' and this custom UIViewController loads its 'view' from a .xib file. This 'view' contains a UITableView (and some other controls that are displayed when the data for the UITableView is first downloaded).
It works fine to begin with - I can see the table view for the first view controller when the first tab is selected, changing tabs displays the other table views - all is good.
My problem is, when I select a row on one of these table views a new custom view controller is instantiated, told to hide the bottom bar when pushed and then is pushed on to the navigation controller. Again - this works as expected. I see the new sub-view and the tab bar is hidden.
The problem is when I return to the previous view, the final row in my UITableView is now obscured by the tab bar (which has correctly reappeared). It seems the process of hiding the bottom bar and then showing it again when returning to the previous view has confused things.
Has anyone encountered this? Any idea what I might be doing wrong?
Check that your UITableView has not the UIViewAutoresizingFlexibleHeight (in IB, see the picture below).
alt text http://www.quicksnapper.com/files/5161/20375276064A0C11D2C33A4_m.png