iOS Masonry a SuperView Как адаптивный sub tableView contentSize? - PullRequest
0 голосов
/ 15 января 2019

ячейка содержит collectionView

это скриншот. 100

ячейка содержит subView, subView содержит collectionView, источник данных является динамическим.

я хочу к этому subView.height = collectionView.contentSize.height.

как узнать collectionView.contentSize; и обновить кладку до superView ?????

[self.pictureView mas_updateConstraints:^(MASConstraintMaker *make) {
      make.height.equalTo(@(self.pictureView.collectionView.contentSize.height));
    }];

NSLog высота = 0;

- (void)setUp {
[self.contentView addSubview:self.avatarImageView];
[self.contentView addSubview:self.nicknameLabel];
[self.contentView addSubview:self.contentLabel];
[self.contentView addSubview:self.pictureView];
[self.contentView addSubview:self.recentGiftView];
[self.contentView addSubview:self.optionView];
[self.contentView addSubview:self.starView];
[self.contentView addSubview:self.commentView];
[self lysupdateConstraints];
}

- (void)lysupdateConstraints {
[self.nicknameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.left.equalTo(self.avatarImageView.mas_right).mas_offset(8);
    make.right.equalTo(self.contentView.mas_right).mas_offset(-11);
    make.centerY.equalTo(self.avatarImageView);
}];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.avatarImageView.mas_bottom).mas_offset(10);
    make.left.equalTo(self.nicknameLabel.mas_left);
    make.right.equalTo(self.contentView.mas_right).mas_offset(-21);
}];
[self.pictureView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.contentLabel.mas_bottom).mas_offset(10);
    make.left.equalTo(self.nicknameLabel.mas_left);
    make.right.equalTo(self.contentView.mas_right).mas_offset(-11);
    make.height.equalTo(@(100));
}];
[self.recentGiftView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.pictureView.mas_bottom).mas_offset(10);
    make.left.equalTo(self.pictureView.mas_left);
    make.right.equalTo(self.contentView.mas_right).mas_offset(-11);
    make.height.equalTo(@(80));
}];
[self.optionView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.recentGiftView.mas_bottom);
    make.left.equalTo(self.pictureView.mas_left);
    make.right.equalTo(self.contentView.mas_right).mas_offset(-11);
    make.height.equalTo(@(37));
}];
[self.starView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.optionView.mas_bottom);
    make.left.equalTo(self.pictureView.mas_left);
    make.right.equalTo(self.contentView.mas_right).mas_offset(-11);
    make.height.equalTo(@(50));
}];
[self.commentView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.starView.mas_bottom);
    make.left.equalTo(self.pictureView.mas_left);
    make.right.equalTo(self.contentView.mas_right).mas_offset(-11);
    make.height.equalTo(@(50));
}];
[self.pictureView mas_updateConstraints:^(MASConstraintMaker *make) {
  make.height.equalTo(@(self.pictureView.collectionView.contentSize.height));
}];
}
...