Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c NSAttributedString的属性如何从CoreText(CTFontRef,…)桥接?_Objective C_Automatic Ref Counting_Nsattributedstring_Core Text_Core Foundation - Fatal编程技术网

Objective c NSAttributedString的属性如何从CoreText(CTFontRef,…)桥接?

Objective c NSAttributedString的属性如何从CoreText(CTFontRef,…)桥接?,objective-c,automatic-ref-counting,nsattributedstring,core-text,core-foundation,Objective C,Automatic Ref Counting,Nsattributedstring,Core Text,Core Foundation,我需要将项目转换为ARC Project的目标是iOS 7.0,它使用了来自CoreText的大多数属性 NSDictionary *aDic = @{(NSString*)kCTFontAttributeName: (id)ctFont, (NSString*)kCTParagraphStyleAttributeName: (id)ctParagraphStyle, (NSString*)kCTFore

我需要将项目转换为ARC

Project的目标是iOS 7.0,它使用了来自CoreText的大多数属性

NSDictionary *aDic = @{(NSString*)kCTFontAttributeName: (id)ctFont,
                       (NSString*)kCTParagraphStyleAttributeName: (id)ctParagraphStyle,
                       (NSString*)kCTForegroundColorAttributeName: (id)[UIColor red].CGColor,
                       (NSString*)kCTKernAttributeName: @-0.5f};
  • 如何正确桥接这些值

    • (\uu桥id)ctFont
      (\uu桥UIFont*)ctFont
      (UIFont*)CfBrigingRelease(ctFont)
    • (\u桥id)ctParagraphStyle
      (\u桥NSParagraphStyle*)ctParagraphStyle
      (NSParagraphStyle*)CfBridgegRelease(ctParagraphStyle)
    • (\uu桥id)[UIColor red].CGColor
      (\uu桥UIColor*)[UIColor red].CGColor
      (UIColor*)CfBrigingRelease([UIColor red].CGColor)
  • 我在iOS9设备上注意到,一些属性,如
    kCTKernAttributeName
    ,可以不加区别地接受记录的
    CFNumberRef
    和未记录的NSNumber*

    • iOS 7上的兼容性也一样吗
    • CGColorRef/UIColor、CTFontRef/UIFont、CTParagraphStyleRef/NSParagraphStyle等是否具有此兼容性