How to fit tableview to superview below navigation bar via storyboard autolayout

旧巷老猫 提交于 2019-12-12 03:17:09

问题


I want to create a scroll disabled tableview which will fill the view below navigation bar. Finally I've managed to do it but it's not the right way because I'm giving minus 64 margin (status bar + navigation bar) to tableview.

I'm assigning my constraints from storyboard. I've tried lots of other constraints with the table view like giving zero constraints from 4 sides or equal width + equal height + center horizontal + center vertical none of them worked.

What is the right way to solve this problem.

Screenshot from the storyboard are below.


回答1:


I solved it.

unchecking four of them and adding the constraints from image below worked as I wanted.

So I guess scroll disabled tableviews not working as expected with these four view controller options checked.




回答2:


As kerem keskin said, unchecking resolves the issue but you don't need to uncheck all four. Just need to uncheck Adjust Scroll View Inset.

Refer to this: iOS 7 -- navigationController is setting the contentInset and ContentOffset of my UIScrollView



来源:https://stackoverflow.com/questions/27527468/how-to-fit-tableview-to-superview-below-navigation-bar-via-storyboard-autolayout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!