I really wonder if it possible to make some text in the same UILabel in diferent colour and diferent size ? if yes how ?
Please thank you so much for the further help.
I really wonder if it possible to make some text in the same UILabel in diferent colour and diferent size ? if yes how ?
Please thank you so much for the further help.
Yeah look at this code:
- (IBAction) btnClickMe_Clicked:(id)sender {
NSString *kw = s.text;
NSString *encodedkw = [kw stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *mms = [NSString stringWithFormat: @"%@", encodedkw];
if ([mms length] == 0){
iMessageLabel.text=@"put text";
} else if ([mms isEqualToString:@"a"]){
iMessageLabel.text=@"this is a";
} else if ([mms isEqualToString:@"b"]){
iMessageLabel.text=@"this is b";
} else if ([mms isEqualToString:@"c"]){
iMessageLabel.text=@"this is c";
}else if ([mms isEqualToString:@"d"]){
iMessageLabel.text=@"this is d";
} else if ([mms isEqualToString:@"e"]){
iMessageLabel.text=@"this is e";
} else if ([ mms isEqualToString:@"f"]){
iMessageLabel.text=@"this is f";
}
}
this is my dictionary app(test app) and i want to make some special colour to the translated text and diferent size also for example.
-A verb this means A
I want tomake "verb" in the bold text. and this is A in the red colur.
I´m very new with this and really dont know if it possible to do like this, and if yes how you do ?
thanks so much
You change the text color like this:
myLabel.textColor=[UIColor blueColor];
You change font like:
myLabel.font= aFont; //a font object you've previously defined.
Edit01: Upon rereading, it appears the OP wants to change text attributes within the same string. In that case, you will need to use CFAttributedString. I haven't used it but I believe it works on the iPhone.
iPhone doesn't have NSAttributedString, and it's pretty obvious that UILabel doesn't have a way to specify per-character attributes. So I think your only answer is to use WebKit (UIWebView).