我的Unicode是\u20AC
當我將它設置爲UILabel
但我在標籤上得到unicode。有一段時間它打印歐元,但大部分時間是在標籤上打印unicode。Unicode在iOS上無法正常工作
我的代碼是在這裏
NSLog(@"Currecy %@",currencySymbol);
UILabel *priceLbl = [[UILabel alloc] initWithFrame:CGRectMake(180, 10, 45, 25)];
priceLbl.textColor = [UIColor whiteColor];
priceLbl.textAlignment = NSTextAlignmentCenter;
priceLbl.font = [UIFont fontWithName:@"ProximaNova-Bold" size:15];
priceLbl.tag = 1001;
fair = [NSString stringWithFormat:@"%d",arc4random()%50];
priceLbl.text = [NSString stringWithFormat:@"%@ %@",fair,currencySymbol];
輸出 Currecy \ u20AC
Printing description of priceLbl:
<UILabel: 0x7faade3095a0; frame = (185 10; 50 25); text = '\u20AC'; userInteractionEnabled = NO; tag = 1001; layer = <_UILabelLayer: 0x7faadbd91bb0>>
而且我想我最終獲得輸出,我會設置喜歡。例如
獲取服務器響應
{
currency = "\\u20AC";
description = "You have been successfully logged in.";
}
and the currency symbol replacing "\\" with "\"
NSString *currency = [response[@"currency"] stringByReplacingOccurrencesOfString:@"\\\\" withString:@"\\"];
你的代碼在哪裏? – hasan83
@ hasan83請參閱我更新的代碼。 –
@halfer是的,它是有用的 –