{"action":"created","issue":{"url":"https://api.github.com/repos/ibireme/YYKit/issues/298","repository_url":"https://api.github.com/repos/ibireme/YYKit","labels_url":"https://api.github.com/repos/ibireme/YYKit/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/ibireme/YYKit/issues/298/comments","events_url":"https://api.github.com/repos/ibireme/YYKit/issues/298/events","html_url":"https://github.com/ibireme/YYKit/issues/298","id":176292118,"number":298,"title":"在iOS10版本下，将苹果的表情字符串绘制成UIImage后显示不出来了","user":{"login":"itdongbaojun","id":5921075,"avatar_url":"https://avatars.githubusercontent.com/u/5921075?v=3","gravatar_id":"","url":"https://api.github.com/users/itdongbaojun","html_url":"https://github.com/itdongbaojun","followers_url":"https://api.github.com/users/itdongbaojun/followers","following_url":"https://api.github.com/users/itdongbaojun/following{/other_user}","gists_url":"https://api.github.com/users/itdongbaojun/gists{/gist_id}","starred_url":"https://api.github.com/users/itdongbaojun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itdongbaojun/subscriptions","organizations_url":"https://api.github.com/users/itdongbaojun/orgs","repos_url":"https://api.github.com/users/itdongbaojun/repos","events_url":"https://api.github.com/users/itdongbaojun/events{/privacy}","received_events_url":"https://api.github.com/users/itdongbaojun/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-12T04:23:18Z","updated_at":"2016-09-13T10:31:24Z","closed_at":"2016-09-13T10:31:24Z","body":"+ (UIImage *)imageWithEmoji:(NSString *)emoji size:(CGFloat)size {\r\n    if (emoji.length == 0 || ![emoji containsEmoji]) return nil;\r\n    if (size < 1) return nil;\r\n    \r\n    CGFloat scale = [UIScreen mainScreen].scale;\r\n    CTFontRef font = CTFontCreateWithName(CFSTR(\"AppleColorEmoji\"), size * scale, NULL);\r\n    if (!font) return nil;\r\n    \r\n    NSAttributedString *str = [[NSAttributedString alloc] initWithString:emoji attributes:@{ (__bridge id)kCTFontAttributeName:(__bridge id)font, (__bridge id)kCTForegroundColorAttributeName:(__bridge id)[UIColor clearColor].CGColor }];\r\n    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();\r\n    CGContextRef ctx = CGBitmapContextCreate(NULL, size * scale, size * scale, 8, 0, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);\r\n    CGContextSetInterpolationQuality(ctx, kCGInterpolationHigh);\r\n    CTLineRef line = CTLineCreateWithAttributedString((__bridge CFTypeRef)str);\r\n    CGRect bounds = CTLineGetBoundsWithOptions(line, kCTLineBoundsUseGlyphPathBounds);\r\n    CGContextSetTextPosition(ctx, 0, -bounds.origin.y);\r\n    CTLineDraw(line, ctx);\r\n    CGImageRef imageRef = CGBitmapContextCreateImage(ctx);\r\n    UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp];\r\n    \r\n    CFRelease(font);\r\n    CGColorSpaceRelease(colorSpace);\r\n    CGContextRelease(ctx);\r\n    if (line)CFRelease(line);\r\n    if (imageRef) CFRelease(imageRef);\r\n    \r\n    return image;\r\n}\r\n\r\n以上这段代码在iOS10上面 将苹果的表情字符串绘制成UIImage后无法显示出来。"},"comment":{"url":"https://api.github.com/repos/ibireme/YYKit/issues/comments/246641011","html_url":"https://github.com/ibireme/YYKit/issues/298#issuecomment-246641011","issue_url":"https://api.github.com/repos/ibireme/YYKit/issues/298","id":246641011,"user":{"login":"itdongbaojun","id":5921075,"avatar_url":"https://avatars.githubusercontent.com/u/5921075?v=3","gravatar_id":"","url":"https://api.github.com/users/itdongbaojun","html_url":"https://github.com/itdongbaojun","followers_url":"https://api.github.com/users/itdongbaojun/followers","following_url":"https://api.github.com/users/itdongbaojun/following{/other_user}","gists_url":"https://api.github.com/users/itdongbaojun/gists{/gist_id}","starred_url":"https://api.github.com/users/itdongbaojun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itdongbaojun/subscriptions","organizations_url":"https://api.github.com/users/itdongbaojun/orgs","repos_url":"https://api.github.com/users/itdongbaojun/repos","events_url":"https://api.github.com/users/itdongbaojun/events{/privacy}","received_events_url":"https://api.github.com/users/itdongbaojun/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T10:31:24Z","updated_at":"2016-09-13T10:31:24Z","body":"thks"}}
{"actor":{"display_login":"itdongbaojun"}}