我正在尝试在我正在处理的iPhone应用程序之一上打印标签中的ascii值。我希望输出是这样的。我该怎么办?
答案 0 :(得分:1)
myLabel.text = @"Cutomer's First Name*";
您可以使用TTTAttributedLabel编辑制作不同颜色的文字。 以下是代码
TTTAttributedLabel *label = [[TTTAttributedLabel alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];
NSString* text = @"Cutomer's First Name*";
[label setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:^(NSMutableAttributedString *mutableAttributedString){
//NSMutableAttributedString *mutableAttributedString;
NSRange whiteRange = [text rangeOfString:@"*"];
if (whiteRange.location != NSNotFound) {
[mutableAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(id)[UIColor redColor].CGColor range:whiteRange];
}
return mutableAttributedString;
}];
label.font = [UIFont fontWithName: @"Helvetica Neue" size: 10];