Ray's playground

 

Decorator(Chapter 16 of Pro Objective-C Design Patterns for iOS)

We have introduced the Decorator pattern with its concepts and different approaches to implement it in Objective-C. A true subclass implementation uses a more structured approach to connect different decorators. A categories approach is simpler and more lightweight than its counterpart. It’s suitable for applications that require only a small amount of decorators for existing classes. Although categories are different from actual subclassing and cannot strictly adapt the original flavor of the pattern, They fulfill the intent to solve the same kind of problems. The Decorator pattern is a natural choice for designing applications like the image filtering example. Any combination of image filters can be applied or removed dynamically without affecting the integrity of the original behaviors of UIImage.

posted on 2012-05-04 09:32  Ray Z  阅读(292)  评论(0编辑  收藏  举报

导航