0

この文字列の度記号に異なるフォント プロパティを設定するにはどうすればよいでしょうか。

http://i.stack.imgur.com/GaDu6.png

現在、次のように値を設定しています。

currentTemp.text = [NSString stringWithFormat:@"%d°", [result[@"main"][@"temp"] intValue]];

そして私のフォントをこのように設定します:

currentTemp.font = [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:80];

ご協力いただきありがとうございます。

4

1 に答える 1

0

NSAttributedStringクラスをチェックしてください: https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/classes/NSAttributedString_Class/Reference/Reference.html

これはまさにあなたが必要とするものです。

NSMutableAttributedString *temp = [[NSMutableAttributedString alloc] initWithString:@"20 C"];
[temp addAttribute:NSFontAttributeName
              value:[UIFont systemFontOfSize:20.0]
              range:NSMakeRange(0, 2)];
[temp addAttribute:NSFontAttributeName
              value:[UIFont systemFontOfSize:18.0]
              range:NSMakeRange(3, 1)];
于 2014-05-29T02:18:13.987 に答える