Update for iOS 11:
IOS 11 introduces the concept of safe areas, and the burden of the container - all the content in the visible area, again, is in the hands of the view, not the tango of vision and the controller.
See Apple documentation here .
When working with a drop-down database or XIB, it is as simple as including a function in Xcode. This is backward compatible and should work as expected in iOS 10 and below. In the code, you should use if (@available(iOS 11.0, *)) to decide whether to set limits on safe direction / area bindings or use outdated manuals for older systems.
When using storyboards, you need to add a limit to the layout guide . This will take care of your problems, since on iOS6, i.e. 0pt and on iOS7, it is dynamic. If you use the nib / xib file, it becomes a little more complex; you need to add a restriction to the code. The easiest way to achieve this is to create a constraint with 0 vertical space up, create an output for this constraint in the code and in viewDidLayoutSubviews , update the constant output limit line to self.topLayoutGuide.length .
Leo natan
source share