#import <Foundation/Foundation.h>
/**
* 分类 , Category ,类目:
作用:为没有源码的类扩充功能.仅仅能扩充方法不能够扩充实例变量.
*/
@interface NSString (SayHi)
- (void)sayHi;
//可以获取首字母,字符串
- (NSString *)firstCharactor;
@end
#import "NSString+SayHi.h"
@implementation NSString (SayHi)
- (void)sayHi
{
NSLog(@"你好你是牛逼的字符串");
}
- (NSString *)firstCharactor
{
return [[self substringToIndex:1] uppercaseString];
}
@end