-----------利用 Categories 实现私有方法.
#import <Cocoa/Cocoa.h>
@interface MyClass: NSObject
-(void) publicMethod;
@end
----------------MyClass.m----
#import "MyClass.h"
// private methods
@interface MyClass (Private)
-(void) privateMethod;
@end
@implementation MyClass (Private)
-(void) privateMethod {
printf( "private method/n" );
}
@end
@implementation MyClass
-(void) publicMethod {
printf( "public method/n" );
[self privateMethod];
}
@end
-------------------这个方法有些别扭,不喜欢-------