iOS equivalent for Android View.GONE visibility mode iOS equivalent for Android View.GONE visibility mode ios ios

iOS equivalent for Android View.GONE visibility mode


Adding a constraint(NSLayoutAttributeHeight) that sets height of the view to 0 worked for me:

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.captchaView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0]];


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


add a height constraint to your view as follows:enter image description here

then make an outlet for the height constraint in your viewController file as follows:enter image description here

& then in your viewDidLoad method change constraint height to 0 as follows:

override func viewDidLoad() {    super.viewDidLoad()nsLcButtonHeight.constant = 0}