下面代码可以遍历移除页面视图上的所有元件
1
2
3
4
5
6
|
//清空所有子视图 func clearViews()
{ for v in self .view.subviews as [ UIView ]
{ v.removeFromSuperview() } } |