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
}
原文地址:http://9507270.blog.51cto.com/9497270/1953935