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