drawInRect:withAttributes vs drawInRect:withFont:lineBreakMode:alignment

前端 未结 2 1395
一整个雨季
一整个雨季 2021-02-05 02:29

I\'m working on a new version of my app and am attempting to replace deprecated messages, but am not able to get past this one.

I can\'t figure out why drawInRect:

2条回答
  •  长发绾君心
    2021-02-05 03:24

    To set the color of text you need to pass the NSForegroundColorAttributeName in the attribute as the additional parameter.

    NSDictionary *dictionary = @{ NSFontAttributeName: self.font,
                                  NSParagraphStyleAttributeName: paragraphStyle,
                                  NSForegroundColorAttributeName: self.textColor};
    

提交回复
热议问题