删除一个view 下的所有子view
extension UIView {
func clearAll(){
if self.subviews.count >0 {
self.subviews.forEach({ $0.removeFromSuperview()});
// xcode7会提示 Result of call to map is unused
//self.subviews.map { $0.removeFromSuperview()};
}
}
}
原文链接:https://www.f2er.com/swift/321622.html