1

Hi guys I got situation where in if I embed NAVIGATION CONTROLLER to VIEW CONTROLLER containing table view, their is some gap gets created between NAVIGATION BAR and PROTOTYPE CELL. Even if I drag and drop NAVIGATION CONTROLLER to canvas and delete its ROOT VIEW CONTROLLER and connect it to the VIEW CONTROLLER containing table view as ROOT VIEW CONTROLLER, then also the same situation occurs. I even try changing the height values of PROTOTYPE CELL but the same thing. photo link https://db.tt/up0sZypj

This situation doesn't occur only when I directly uses NAVIGATION CONTROLLER with its own ROOT VIEW CONTROLLER. photo link https://db.tt/JssxrNbe

So please help me out of this situation. I have given photo link because I can't attach photos as I don't have 10 reputed posts, am really sorry for that.

Anirudha Mahale
  • 2,526
  • 3
  • 37
  • 57

2 Answers2

1

You probably have the top constraint of your tableView set to the top layout guide and have extended edges under top bars enabled.

If so you can either remove the top constraint and drag the top of your tableView to top of your superview; underneath the navigation controller. Then set the top constraint to 0 to the top of your superview.

or

You can uncheck the extended edges under top bars checkbox in the attribute inspector when the UIViewController is selected

Alan Perez
  • 186
  • 4
  • Thanks a lot for the reply, I tried whatever you told me. I changed the top constrain of the TableView to -63 and the TableView went beneath the navigation bar but rather than doing this I want to know why the Prototype Cells's height get increased when I embed in the NavigationController manually. – Anirudha Mahale Jan 05 '16 at 08:00
  • From the improper image you posted it is not that the prototype cell is getting bigger. The padding from the top comes from the view controller setting content insets of the table view, so that the table views content can show through the navigation bar when scrolling. – Alan Perez Jan 05 '16 at 08:10
  • so please can you tell me proper steps.... am new here so i doesn't know much... please tell me step by step what to do..... thanks alot for your valuable time.... – Anirudha Mahale Jan 05 '16 at 08:25
  • Please can you see this question of mine http://stackoverflow.com/questions/40632326/multiple-collectionview-in-multiple-tableview-cells – Anirudha Mahale Nov 17 '16 at 05:36
1

Try this may help you. Uncheck option for ScrollView inset for UIViewController in which your TableView resides.

enter image description here

technerd
  • 14,144
  • 10
  • 61
  • 92