首页 > 如何用代码实现 subview.Top = self.topLayoutGuide.Bottom 这样的AutoLayout约束

如何用代码实现 subview.Top = self.topLayoutGuide.Bottom 这样的AutoLayout约束

正在使用autolayout,现在要做的事情是在view controller的view中添加一个subview,并使得subview充满整个view。但是我的viewController的view上面有个navigationBar, 所以我使用viewController的topLayoutGuide属性,实现如下:

但是这个效果是,我subview的top还是不在topLayoutGuide.Bottom,它位于更上方的位置。所以我觉得这个效果是 "subview.top = self.topLayoutGuide.Top", 所以我怎样才能实现 "subview.top = self.topLayoutGuide.Bottom"这样的约束呢?


距离 toplayoutguide.bottom 44 就好了

【热门文章】
【热门文章】