when to use “willChangeValueForKey” and “didChangeValueForKey”?

前端 未结 8 829
我在风中等你
我在风中等你 2021-01-30 10:53

I saw these lines in a demo project, but I couldn\'t understand why it did that.

[self willChangeValueForKey:@\"names\"];
[self didChangeValueForKey:@\"names\"];         


        
8条回答
  •  天涯浪人
    2021-01-30 11:55

    Posting this in July 2013, and it no longer seems to be necessary to call will/didChangeValueForKey. It seems to be taken care of automatically, even if you have a custom setter.

提交回复
热议问题