override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
方法中是否需要添加代码:
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
方法中是否需要添加代码:
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
不需要。
这个方法继承自 NSObject,而 NSObject 里对该方法的实现是个空方法。
也就是说即使你 super 一下,除了多写一行外也就没啥卵用了。