NSArray *familyNames = [[NSArrayalloc]initWithArray:[UIFontfamilyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNamescount]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNamesobjectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
for (indFont=0; indFont<[fontNamescount]; ++indFont)
{
NSLog(@" Font name: %@", [fontNamesobjectAtIndex:indFont]);
}
}
NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:@"52元起,走遍全球都不怕!\n全球旅游险为您提供医疗费用补偿、 航班延误、托运行李丢失等13项保障,更享24小时紧急支援服务,保额高达270万元。"];
[attriString addAttribute:NSFontAttributeName
value:[UIFont systemFontOfSize:15]
range:NSMakeRange(0, attriString.length)];
[attriString addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(0, 4)];
[attriString addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(43, 5)];
[attriString addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(66, 5)];
- (void)colorChange:(UIColor *)color{
const CGFloat *nowColor = CGColorGetComponents(color.CGColor);
NSString *str = [NSString stringWithFormat:@"#%.2x%.2x%.2x",(NSInteger)(nowColor[0]*255),(NSInteger)(nowColor[1]*255),(NSInteger)(nowColor[2]*255)];
NSLog(@"str = %@",str);
_bcolorStr = str;
[head changeTheBColor:color];
}