美文网首页
Masonry/SnapKit 约束scrollView的问题

Masonry/SnapKit 约束scrollView的问题

作者: xiny123 | 来源:发表于2016-06-16 20:45 被阅读0次

    最近做项目,在用Masonry ,约束好了scrollView,但是就是不能滑动。参考网上的方法,解决了。

    ```
     [self.scrollView      mas_makeConstraints:^(MASConstraintMaker                       *make {
    make.left.right.top.bottom.equalTo(self.view);
    }];
    
     创建一个 contentView 添加到 scrollView上
    
      self.contentView = [[UIView alloc] init];
     [self.scrollView addSubview:self.contentView];
    
    约束
    
    [self.contentView     mas_makeConstraints:^(MASConstraintMaker *make) {
    make.edges.equalTo(self.scrollView);
    make.width.equalTo(self.scrollView);
    }];
    
    重新设置contentView的bottom
    
    
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.bottom.equalTo(view.as_bottom);
    }];
    

    相关文章

      网友评论

          本文标题:Masonry/SnapKit 约束scrollView的问题

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