{"id":615,"date":"2014-08-09T23:28:21","date_gmt":"2014-08-09T15:28:21","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=615"},"modified":"2016-07-15T16:39:29","modified_gmt":"2016-07-15T08:39:29","slug":"%e5%88%9b%e5%bb%ba%e5%b8%a6%e6%a0%b7%e5%bc%8f%e7%9a%84%e5%ad%97%e7%ac%a6%e4%b8%b2attributedstring%ef%bc%88%e5%af%8c%e6%96%87%e6%9c%ac%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2014\/08\/09\/232821615.html","title":{"rendered":"\u521b\u5efa\u5e26\u6837\u5f0f\u7684\u5b57\u7b26\u4e32AttributedString\uff08\u5bcc\u6587\u672c\uff09"},"content":{"rendered":"<pre lang=\"objc\" line=\"1\">+ (id)stringWithDefaultStyle:(NSString *)string kern:(CGFloat)kernValue\n{\n    NSNumber *kern = [NSNumber numberWithFloat:kernValue];\n    NSNumber *underline = [NSNumber numberWithInt:NSUnderlineStyleSingle];\n    UIFont   *font = [UIFont boldSystemFontOfSize:17];\n    UIColor  *color = kOrange(1.0);\n\n    NSDictionary *attrsDic = @{\n                               NSKernAttributeName: kern,                   \/\/ \u5b57\u95f4\u8ddd\n                               NSUnderlineStyleAttributeName: underline,    \/\/ \u4e0b\u5212\u7ebf\n                               NSForegroundColorAttributeName: color,       \/\/ \u5b57\u4f53\u989c\u8272\n                               NSFontAttributeName: font\n                               };\n\n    return [[NSAttributedString alloc] initWithString:string attributes:attrsDic];\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>+ (id)stringWithDefaultStyle:(NSString *)string kern:(CGFloat)kernValue { NSNumber *kern = [NSNumber numberWithFloat:kernValue]; NSNumber *underline = [NSNumber numberWithInt:NSUnderlineStyleSingle]; UIFont *font = [UIFont boldSystemFontOfSize:17]; UIColor *color = kOrange(1.0); NSDictionary *attrsDic = @{ NSKernAttributeName: kern, \/\/ \u5b57\u95f4\u8ddd NSUnderlineStyleAttributeName: underline, \/\/ \u4e0b\u5212\u7ebf NSForegroundColorAttributeName: color, \/\/ \u5b57\u4f53\u989c\u8272 NSFontAttributeName: font }; return [[NSAttributedString alloc] initWithString:string attributes:attrsDic]; }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[20],"class_list":["post-615","post","type-post","status-publish","format-standard","hentry","category-project","tag-basics"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=615"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/615\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}