写法:
#import <Foundation/Foundation.h>
extern NSString *const PersonType;
@interface Person : NSObject
@end
------------------------------------
#import "Person.h"
NSString *const PersonType = @"都是男人";
@implementation Person
@end
- 此时
PersonType
这个常量字符串就对外公开了,要想获取的PersonType
只需要import Person.h
即可。 - 命名时最好以类名为前缀,方便区分
网友评论