Extensions.swift =>
import Foundation
import UIKit
// MARK:- UIView
extension UIView {
func updateView() {
for view in self.subviews {
view.updateView()
}
}
}
BasicallyView.swift =>
import UIKit
class BasicallyView: UIView{
override func updateView() {
super.updateView()
}
}
自定义的View =>
override func updateView() {
super.updateView()
//写自己需要的代码,如下
self.backgroundColor = UIColor.clear
}
原文链接:https://www.f2er.com/swift/321345.html