作者:储兰兰快乐 | 来源:互联网 | 2022-12-25 23:19
将数字转为#defineEMOJI_CODE_TO_SYMBOL(x)((((0x808080F0|(x&0x3F000)4)|(x&0xFC0)-(void)viewDi
//将数字转为
#define EMOJI_CODE_TO_SYMBOL(x) ((((0x808080F0 | (x & 0x3F000) >> 4) | (x & 0xFC0) <<10) | (x & 0x1C0000) <<18) | (x & 0x3F) <<24);
- (void)viewDidLoad {
[super viewDidLoad];
//单独调用
int sym = EMOJI_CODE_TO_SYMBOL(0x1F600);
NSString *emoT = [[NSString alloc] initWithBytes:&sym length:sizeof(sym) encoding:NSUTF8StringEncoding];
NSLog(@"arr==%@",emoT);
//获取数组
NSArray *arrEmotion = [self defaultEmoticons];
for (NSString *str in arrEmotion) {
NSLog(@"===%@",str);
}
}
//获取默认表情数组
- (NSArray *)defaultEmoticons {
NSMutableArray *array = [NSMutableArray new];
for (int i=0x1F600; i<=0x1F64F; i++) {
if (i <0x1F641 || i > 0x1F644) {
int sym = EMOJI_CODE_TO_SYMBOL(i);
NSString *emoT = [[NSString alloc] initWithBytes:&sym length:sizeof(sym) encoding:NSUTF8StringEncoding];
[array addObject:emoT];
}
}
return array;
}
2015-03-03 18:30:11.251 MyTest02[5948:3164472] arr==iOS开发,系统自带表情的获取