when to use “willChangeValueForKey” and “didChangeValueForKey”?

前端 未结 8 806
我在风中等你
我在风中等你 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:32

    Those have to do with manually controlling key value observing. Normally the system takes care of it but these allow you some control. Look at this documentation to understand when and how to use them here.

提交回复
热议问题