iOS equivalent for Android View.GONE visibility mode

前端 未结 13 764
臣服心动
臣服心动 2020-12-12 19:22

I\'m developing an app for iOS and I\'m using the Storyboard with AutoLayout ON. One of my view controllers has a set of 4 buttons, and in certain circumstances i would like

13条回答
  •  眼角桃花
    2020-12-12 19:55

    All of answers on this questions are inefficient. Best way to equvailent of Android setVisibility:Gone method on iOS is that StackView first select components then in editor, embed in, Stack View,

    connect new stack view with IBOutlet, then:

    hidden:

    UIView * firstView = self.svViewFontConfigure.arrangedSubviews[0];
            firstView.hidden = YES;
    

    visibility:

    UIView * firstView = self.svViewFontConfigure.arrangedSubviews[0];
            firstView.hidden = NO;
    

    as using stack view, all constraints will be keeped!

    Document

提交回复
热议问题