iPhone:如何在UILabel字符串文本中添加“Degree”符号?

时间:2010-05-06 17:50:55

标签: iphone

我希望将天气报告的“度”符号包含在45摄氏度中。如何在字符串中添加度数符号以包含UILabel?

如果有人知道,请与我分享。

谢谢。

4 个答案:

答案 0 :(得分:82)

切换选项-8?

答案 1 :(得分:3)

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"80\u00b0c"];
    [attributedString setAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"Helvetica-light" size:10.0]
                                      , NSBaselineOffsetAttributeName : @22} range:NSMakeRange(2, 2)];
    //asign this as a 
examplelabel.attributedtext = attributedString;

答案 2 :(得分:3)

在Xcode 8.0中: 按Control + Command + Space Bar或Xcode-> Edit-> Emoji&符号,稍后从弹出屏幕中搜索度数符号。 您可以轻松添加UILabel或TextView组件。

答案 3 :(得分:1)

在Swift中

cell.lblTemperature.text = NSString(format:"23%@", "\u{00B0}") as String
相关问题