Masonry的iOS 11适配

作者: makemake | 来源:发表于2017-10-12 11:11 被阅读222次

    Masonry 在iOS 11中新增属性:

    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeading NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTrailing NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideWidth NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideHeight NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideCenterX NS_AVAILABLE_IOS(11.0);
    @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideCenterY NS_AVAILABLE_IOS(11.0);
    

    用法:

        [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
            if (@available(iOS 11.0, *)) {
                make.edges.equalTo(self.view.mas_safeAreaLayoutGuide);
            } else {
                make.edges.equalTo(self.view);
            }
        }];
    

    相关文章

      网友评论

      • 千若逸:是Masonry,不是Mansonry
        makemake:谢谢指正,打的太快咯。。
      • 辣枭子:我这边怎么没更新了?
        辣枭子:@makemake 本地库没更新,刚下载好,谢谢分享
        makemake:GitHub重新下载一下,我也是才下的

      本文标题:Masonry的iOS 11适配

      本文链接:https://www.haomeiwen.com/subject/bzunyxtx.html