0

I have UITableViewController that can be accessed using segue from other ViewController that is inside UINavigationController.

My table has two sections with static cells I also manually added view (dark navy color) with custom UIButton.

In interface builder it looks like this

enter image description here

But when I open my app in simulator - I get this stripe in the top. So I have few questions about this.

enter image description here

1) Where this stripe came from?

2) How can I make it disappear? I tried something like

self.tableView.contentInset = UIEdgeInsets(top: -16, left: 0, bottom: 0, right: 0)

I am not sure that this is right way.

3) For future - is it ok to add UIView to top of UITableViewController manually as I did

Update This is debug view enter image description here

moonvader
  • 19,761
  • 18
  • 67
  • 116
  • yes, creating an `UIView` is ok solution, just create some function like `addStatusBarView(with color: UIColor)` and call whenever you want to add this view – JuicyFruit Aug 17 '17 at 10:41
  • What are you referring to by stripe? the status bar with the time and battery level? – ahbou Aug 17 '17 at 10:44

2 Answers2

1
  1. Debug your view to see why your header is higher. Documentation Debugging in Xcode
  2. You don't need to remove it because it not normal. You probably using a wrong constant.
  3. Yes, you can..
bartosss
  • 1,030
  • 9
  • 16
  • 1
    https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/debugging_with_xcode/chapters/special_debugging_workflows.html – bartosss Aug 17 '17 at 10:46
  • Great tool - thank you - never used it before. I updated my question with screenshot from it. So as I see it is not Status Bar? – moonvader Aug 17 '17 at 10:55
  • I suggest following some tutorials/trainings in developing iOS apps. You'll learn a ton and feel more comfortable. – bartosss Aug 17 '17 at 11:35
  • It probably is a setting on the `navigationItem` – bartosss Aug 17 '17 at 11:36
0

This spacing was solved with unchecking on of default View Controller properties in interface builder!

YouStoryboard.storyboard > YouViewController > Attributes inspector > Uncheck - Adjust scroll view insets.

Thanks to https://stackoverflow.com/a/19117685/1218405

moonvader
  • 19,761
  • 18
  • 67
  • 116