iOS - UI moves after touching

advertisements

I have a view with an image and two labels. It looks like this:

It has a constraint with 0 to the top. But it looks like this in real:

The whole view is like 50px below the titlebar. But when I click somewhere on the view, it slides up and looks like this:

It should be like this, but why is first like 50px below the position I want? When you look close you can see that the image moves a little bit into the title.


Do like this,

override func viewDidLoad() {
    super.viewDidLoad()
    self.automaticallyAdjustsScrollViewInsets = false
    self.edgesForExtendedLayout = UIRectEdge()
}