美文网首页
pod导入Masonry使用Margin闪退问题

pod导入Masonry使用Margin闪退问题

作者: 小時間光 | 来源:发表于2018-11-02 10:30 被阅读40次
  //==============================
    UIView *redView = [[UIView alloc]init];
    [self.view addSubview:redView];
    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
        //
        make.top.mas_equalTo(self.view.mas_topMargin);
        //
        make.left.mas_equalTo(self.view.mas_left).with.offset(0);
        //
        make.right.mas_equalTo(self.view.mas_right).with.offset(0);
        //
        make.bottom.mas_equalTo(self.view.mas_bottomMargin);
    }];
    redView.backgroundColor = [UIColor redColor];

报错

-[UIView mas_topMargin]: unrecognized selector sent to instance

解决方法,在pod中修改Masonry最低支持版本为iOS 8.0即可,

A12.png

运行成功,


iPhone X

参考 Masonry v1.1.0 crash with UIView margins #461

参考Stack Overflow Set deployment target for CocoaPods's pod

相关文章

网友评论

      本文标题:pod导入Masonry使用Margin闪退问题

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