登录

ios - masory中如何使用viewController的topLayoutGuide?

自动布局第三方masory如何使用topLayoutGuide?如题

# iOS
大家讲道理大家讲道理2178 天前458 次浏览

全部回复(1) 我要回复

  • 阿神

    阿神2017-04-17 17:34:47

    topLayoutGuidebottomLayoutGuide 都是 iOS 7 后 UIViewController 增加的属性。

    topLayoutGuide 通常表示当前页面的上方被 StatusBar 和 NavigationBar 遮挡的部分。在 Masonry 的 API 中可以这样用:

    [myView mas_makeConstraints:^(MASConstraintMaker *make) {
        // 把 myView 的 top 和 self(UIViewController) 的 topLayoutGuide 的那部分界面的 top 对齐。
        make.top.equalTo(self.mas_topLayoutGuide);
        // ...
    }];

    回复
    0
  • 取消回复发送