Masonry设置HeaderView

2019-09-28  本文已影响0人  丶小杨_
    //masonry 设置HeaderView
    UIView * bgView= [[UIView alloc]init];
    [bgView addSubview:self.headerV];
    [self.headerV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(bgView);
    }];
    
    // 网络加载 --- 创建带标题的图片轮播器
    [self.headerV addSubview:self.cycleV];
    [self.cycleV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.headerV);
        make.height.mas_equalTo(bannerH);
    }];
    
    
    [self.headerV mas_updateConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.cycleV.mas_bottom).offset(10);
    }];

    self.tableView.tableHeaderView = bgView;
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.width.equalTo(self.tableView);
    }];

    [self.tableView layoutIfNeeded];

上一篇下一篇

猜你喜欢

热点阅读