Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我想观察hiddenUIView 上的属性:
hidden
@property(nonatomic, getter=isHidden) BOOL hidden
我是为 keypath 添加一个观察者hidden还是isHidden?
isHidden
hidden.
从另一面考虑:设置属性。设置器将是setHidden:,不是setIsHidden:,您的属性分配将是self.hidden = flag,不是self.isHidden = flag。
setHidden:
setIsHidden:
self.hidden = flag
self.isHidden = flag