To hide a view in UIStackView , is it better to set isHidden to true or use removeArrangedSubview and instead remove the view from the parent Stackview ?
I use Stackview to organize my UIElements in a tableView cell. I currently have a parent StackView and a child stackview located inside. The children's performance should be displayed or hidden depending on the state. I set the isHidden property of the child view to true when the condition becomes true.
When I browse and new cells appear, they become visible. I get the following messages in the console. The application does not crash.
NSLayoutConstraint: 0x600000093470 'UISV-canvas-connection' UIStackView: 0x7fd4527201b0.top == UILabel: 0x7fd452720370 "Disconnecting - rest and sleep ...". top (active)
Set a symbolic breakpoint on UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. Methods in the UIConstraintBasedLayoutDebugging category in UIView, listed in <UIKit/UIView.h> may also be useful. [LayoutConstraints] Unable to satisfy constraints at the same time. Probably at least one of the restrictions on the following list is one you don't want.
Try the following:
- look at each restriction and try to find out what you are not expecting;
- find the code that added the unwanted restriction or restrictions and correct it. ("," ",", "", "," "," ")
Will try to recover, violating the restriction
ios swift swift3 uistackview
jay
source share