0
At a certain time of my application I consume an API and add buttons in a Stack View.
The name of my Stack view is "viewPossibleAnswer".
for answer in newListsResponses {
let newButton = UIButton()
newButton.setTitle(answer.sentence, for: .normal)
newButton.setTitleColor(UIColor.white, for: .normal)
self.viewPossibleAnswer.addSubview(newButton)
}
This way is inserting the buttons very well but I need to remove all the buttons inside the Stack View at a certain time.
I did the following function to try to remove all buttons inside the Stack View.
for itemSubView in self.viewPossibleAnswer.arrangedSubviews{
self.viewPossibleAnswer.removeArrangedSubview(itemSubView)
}