iOS 개발, 시스템 자체 표정 획득

// 
#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;
}

출력 결과:
전재 설명 출처:http://blog.csdn.net/u011439689/article/details/44041359

좋은 웹페이지 즐겨찾기