How can I add a degree sign to a string?

后端 未结 4 1250
陌清茗
陌清茗 2021-02-12 09:29

I\'m writing in Objective-C. How can I add a degree sign to a string? I know its unicode: 00B0 and UTF8: C2 B0.

4条回答
  •  情书的邮戳
    2021-02-12 09:51

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

提交回复
热议问题