How can I use Autolayout to set constraints on my UIScrollview?

后端 未结 18 1692
别那么骄傲
别那么骄傲 2020-11-28 00:43

I have spent two days trying out the various solutions for Mixed and Pure Autolayout approaches to achieve what was a trivial scrollview setup prior to autolayout, and it\'s

18条回答
  •  感动是毒
    2020-11-28 01:35

    If your question is "How do I put a bunch of UITextFields in a vertically scrolling UIScrollView such that they move out of the way of the keyboard when they have focus", the best answer is:

    Don't.

    Use a UITableViewController with static cells instead.

    You get this scroll-out-of-the-way behaviour for free, AND all the content insets Just Work if your view controller is displayed inside a UINavigationController.

提交回复
热议问题