UIDeviceWhiteColor ctFontRef无法识别的选择器发送到实例

时间:2014-12-02 09:00:25

标签: ios objective-c ios8

我的应用崩溃并显示此错误

-[UIDeviceWhiteColor ctFontRef]: unrecognized selector sent to instance 0x7fbd7d892e60

我搜索了很多,但没有找到任何解决方案

当我将此归属文本设置为标签

 cell.nameLbl.attributedText = [self makeAttributedString:data.userNameStr name:data.nameStr];

-(NSAttributedString*)makeAttributedString : (NSString*)userNameStr name : (NSString *)nameStr
{

NSString *tempStr = [NSString stringWithFormat:@"%@ %@",[nameStr capitalizedString],[userNameStr lowercaseString]];

NSMutableAttributedString* attrStr = [[NSMutableAttributedString alloc]initWithString:tempStr];


[attrStr addAttribute: NSForegroundColorAttributeName value: [UIColor colorWithRed:0.200 green:0.455 blue:0.749 alpha:1.000]  range:[tempStr rangeOfString:[nameStr capitalizedString]]];
[attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0.675 green:0.718 blue:0.753 alpha:1.000] range:[tempStr rangeOfString:[userNameStr lowercaseString]]];
[attrStr addAttribute:NSFontAttributeName value: [UIFont fontWithName:@"HelveticaNeue" size:16] range:NSMakeRange(0, tempStr.length)];


return attrStr;

}

0 个答案:

没有答案