Using AutoLayout programmatically for search bar and UITableView

前端 未结 3 1208
野趣味
野趣味 2021-01-20 06:00

I have a container view that is nearly the full screen sans the status bar.

I then created a UISearchController and a UITableView. I am using ios 9 and doing things

3条回答
  •  离开以前
    2021-01-20 06:31

    You want to attach the top of the UITableView to the bottom of the top layout guide.

    That top layout guide is only available to you when using a Storyboard.

    One more reason to use Interface Builder.


    Reason number 1 = you wouldn't have this bug in the first place, you would be able to visualize your constraints, and you could achieve all this with exactly 0 lines of code.

    I'm absolutely certain that with the right amount of effort, and support from the SO Community, you can do everything in code. I just find that IB saves not only design time, but offloads debugging to the OS, and ensures longer lifespan to any app. Storyboard allows you to concentrate on what makes your app different from my app, instead of agonizing over layout glitches.

提交回复
热议问题