In order to hide a subview in UIStackView
is it better to set the isHidden
to true or to use removeArrangedSubview
and remove the subview from the parent Stackview
instead ?
I am using a Stackview to arrange my UIElements in the tableView cell.
I currently have a parent StackView and a childStackview arranged inside. The child view needs to be shown or hidden based on a condition. I am setting the isHidden
property of the child view to true when the condition turns true.
When I scroll and new cells come become visible I get the following messages in the console. The app does not crash.
NSLayoutConstraint:0x600000093470 'UISV-canvas-connection' UIStackView:0x7fd4527201b0.top == UILabel:0x7fd452720370'Day Off - Rest and Sleep ...'.top (active)
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h>
may also be helpful.
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
- look at each constraint and try to figure out which you don't expect;
- find the code that added the unwanted constraint or constraints and fix it. ( "", "", "", "", "", "", "" )
Will attempt to recover by breaking constraint