SDAutolayout图片大小根据数量变化

只需要在自定义的PhotoContainerView中做一下判断就可以了

if (self.photoNamesArray.count == 1) {
        [self setupAutoWidthFlowItems:[temp copy] withPerRowItemsCount:1 verticalMargin:10 horizontalMargin:10 verticalEdgeInset:0 horizontalEdgeInset:0];
    } else if (self.photoNamesArray.count == 2) {
        [self setupAutoWidthFlowItems:[temp copy] withPerRowItemsCount:2 verticalMargin:10 horizontalMargin:10 verticalEdgeInset:0 horizontalEdgeInset:0];
    } else {
        [self setupAutoWidthFlowItems:[temp copy] withPerRowItemsCount:3 verticalMargin:10 horizontalMargin:10 verticalEdgeInset:0 horizontalEdgeInset:0];
    }
    
原文地址:https://www.cnblogs.com/mafeng/p/5858038.html