【发布时间】:2021-09-12 17:14:03
【问题描述】:
我在我的应用程序开始时使用一个类添加了 24 个按钮,用户可以按下其中任何一个或全部。然后按下了“另一个”按钮我想删除所有这 24 个按钮。
添加它们:
for j in 0...2 {
for i in 0...7 {
// use the CLASS KSPIckButton to format the buttons
let buttonOne: UIButton = KSPickButton(frame: CGRect(x: (j + 1) * 28 + (j * 80), y: (i + ii) * 35 + buttonSet, width: 110, height: 30))
// Add the button to the storyboard
self.view.addSubview(buttonOne)
}
}
如何删除它们?
我想在所有 24 个按钮中使用一个简单的循环 self.view.Remove() 但不知道怎么做?
【问题讨论】: