AutoLayout with hidden UIViews?

后端 未结 13 1408
南方客
南方客 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 09:56

    In this case, I map the height of the Author label to an appropriate IBOutlet:

    @property (retain, nonatomic) IBOutlet NSLayoutConstraint* authorLabelHeight;
    

    and when I set the height of the constraint to 0.0f, we preserve the "padding", because the Play button's height allows for it.

    cell.authorLabelHeight.constant = 0; //Hide 
    cell.authorLabelHeight.constant = 44; //Show
    

提交回复
热议问题