I have a stack view to which I programmatically add buttons. There are "tabs" where the user can select different categories. However, when I select a new category, the new buttons are just added underneath. Is there a way to delete the contents of tackStack? Then I could call that function before adding buttons when a new category is selected.
I know there is something called removeArrangedSubview, but I am unsure how to use this on buttons that are added programmatically
I know there is something called removeArrangedSubview, but I am unsure how to use this on buttons that are added programmatically
Code Block @IBOutlet weak var tackStack: UIStackView! func addButtons() { for (key,value) in tackInventory{ let button = UIButton() button.setTitle("\(foundColor) \(product.brand) \(product.category), amount: \(value)", for: UIControl.State.normal) tackStack.addArrangedSubview(button) } }