开发者

Setting modified flag in a class

开发者 https://www.devze.com 2023-04-10 15:32 出处:网络
Say I have a class Car that has 2 properties: NSMutableArray *parts and BOOL modified parts is an array of custom object called Part. I want modified to be set to YES if any property of any Part in

Say I have a class Car that has 2 properties:

NSMutableArray *parts and BOOL modified

parts is an array of custom object called Part. I want modified to be set to YES if any property of any Part in the array is modified.

I开发者_C百科s this a good candidate for KVO or is there a better way to do this?


YES ! That's exactly what KVO is made for, and your use case is a typical usage for this :)

0

精彩评论

暂无评论...
验证码 换一张
取 消