1

PureLayout を使用して制約を作成しています

cellForItemAtIndexPath

if (!_itemDetails){
            _itemDetails = cell.itemDetails;
            _itemDetailsConstraint = [_itemDetails autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:cell.imageView];
        }

そして、scrollDidView

float scrollViewHeight = self.collectionView.frame.size.height;
    float scrollOffset = self.collectionView.contentOffset.y;

    if(_itemDetails){

        if (scrollOffset + scrollViewHeight < CGRectGetMaxY(_frontImageView.frame)){

            _itemDetailsConstraint.constant =  CGRectGetMaxY(_frontImageView.frame) - (scrollOffset + scrollViewHeight);

        }
        else{
            _itemDetailsConstraint.constant = 0;
        }
    }

    [_itemDetails.superview layoutIfNeeded];

デバッグ中に制約の定数が変更されたことがわかりますが、ビューは新しい場所に更新されません。

私も試しました

[self.view layoutIfNeeded]

[self.collectionView layoutIfNeeded]

_itemDetailsビューの ( のビューを指しているCollectionViewCell) ロケーションを更新するにはどうすればよいですか?

4

1 に答える 1