开发者

Implementing Cocoa Bindings pattern

开发者 https://www.devze.com 2023-02-25 08:17 出处:网络
I have a class MyImage, that have a NSAffineTransform member transform. In my AppDelegate a have a NSMutableArray of images.

I have a class MyImage, that have a NSAffineTransform member transform.

In my AppDelegate a have a NSMutableArray of images.

I have a MyView that draw the images from AppDelegate.images. So it must track changes in AppDelegate.images and redraw th开发者_C百科e content.

What is the best way to implement this though bindings?


You don't mean bindings, or if you do you have misunderstood how bindings work and what they are for.

For an explanation read this post - Manual binding in Cocoa

You need to use KVO to observe the array of images. You need to make sure you add and remove images from the array in a KVC compliant way.

0

精彩评论

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

关注公众号