2010-01-29 68 views

回答

10

這是通過使用類別完成的。您可以使用類別將方法添加到任何類。請參閱:https://developer.apple.com/library/mac/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html#//apple_ref/doc/uid/TP40011210-CH6-SW1

例子:

#import "ClassName.h" 

@interface ClassName (CategoryName) 
// method declarations 
@end 
+0

+1給了代碼示例.. – Mahes 2011-10-28 15:46:38

+0

所以大家都知道,所提供的鏈接斷開。 – 2013-12-09 20:51:40