AutoLayout with hidden UIViews?

后端 未结 13 1436
南方客
南方客 2020-11-27 09:27

I feel like it\'s a fairly common paradigm to show/hide UIViews, most often UILabels, depending on business logic. My question is, what is the best

13条回答
  •  囚心锁ツ
    2020-11-27 10:10

    Try BoxView, it makes dynamic layout concise and readable.
    In your case it is:

        boxView.optItems = [
            firstLabel.boxed.useIf(isFirstLabelShown),
            secondLabel.boxed.useIf(isSecondLabelShown),
            button.boxed
        ]
    

提交回复
热议问题