归属文本问题

时间:2014-08-02 15:23:37

标签: ios nsattributedstring uifont

所以我正在尝试使用以下代码创建一个属性字符串

color = [TGAPublic blue];
finalMessageString = [NSString stringWithFormat:@"%@ is now following you!",variable1];

attributedString = [[NSMutableAttributedString alloc] initWithString:finalMessageString ];

[attributedString beginEditing];

[attributedString addAttribute:NSFontAttributeName
                         value:[TGAPublic RobotoLightwithSize:10]
                         range:[finalMessageString rangeOfString:finalMessageString]];

range1 = [finalMessageString rangeOfString:variable1];
[attributedString addAttribute:NSFontAttributeName
                                 value:[TGAPublic RobotoBoldwithSize:15]
                                 range:range1];

[attributedString endEditing];

代码[TGAPublic blue]返回UIColor,[TGAPublic RobotoLightWithSize:10]返回UIFont大小10.但是,这些似乎不会影响实际的属性字符串......

0 个答案:

没有答案