I have a UITableView with a data source of NewsItem objects that is stored in an array. In my NewsItem object I have a BOOL called ‘imageState’ that I wanted to be tracked. I wanted to use KVO such that when the value of this imageState changed then the UIViewController that has the NewsItem array be notified and it would then do some stuff (i.e: reloading the cells or something). How do I do something like this? Is it first of all doable?
Share
you can add the observer in the TableViewController , like this
it will observering the object , and when it change it will call this method , you should implement this method below:
if class NewsItem is your class , I think it is better use Delegate or Notification . The KVO is not a better way .