2010年4月12日 星期一

Something about Category and Extention

Category 和 Extention 有著非常相似的使用方式, 然而卻還是有些不同的使用情境. 基本上, Extention 是個
"anonymous" Category.
讓我們來復習一下 Category 的寫法:

@interface MyClassName ( MyCategoryName)
// extra methods' definitions
- (void)superShrimp;
@end

然後再看看 Extention
@interface MyClassName ()
// extra methods' definitions
- (void)superShrimp;
@end