Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ipad(ios)上格式化日期后的未知字符_Ios_Ipad_Core Plot_Nsdateformatter - Fatal编程技术网

ipad(ios)上格式化日期后的未知字符

ipad(ios)上格式化日期后的未知字符,ios,ipad,core-plot,nsdateformatter,Ios,Ipad,Core Plot,Nsdateformatter,我使用核心图绘制条形图。我已经在x轴上显示了日期。我使用了以下代码: NSDateFormatter * formatter=[[NSDateFormatter alloc]init]; [formatter setDateFormat:@"dd MMM yy"]; double tickLocation=0.5; NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity:[valuesArray count]]; for

我使用核心图绘制条形图。我已经在x轴上显示了日期。我使用了以下代码:

NSDateFormatter * formatter=[[NSDateFormatter alloc]init];
[formatter setDateFormat:@"dd MMM yy"];

double tickLocation=0.5;
NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity:[valuesArray count]];
for ( HistoryIndividualValueBean * value in valuesArray)
{
    CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText:[formatter stringFromDate:value.submittedTime] textStyle:x.labelTextStyle];
    newLabel.tickLocation = [[NSNumber numberWithDouble:tickLocation++] decimalValue];
    newLabel.offset       = x.labelOffset + x.majorTickLength;
    newLabel.rotation     = M_PI_2;
    [customLabels addObject:newLabel];
    [newLabel release];
}

[formatter release];

x.axisLabels = [NSSet setWithArray:customLabels];
这在iphone上运行良好。但在ipad上,它在日期中显示奇怪的字符(我已经在上面格式化了)。请参阅此图:


您看到这种行为的原因是
MMM
格式是特定于语言环境的。在日本,它将月份格式化为月份编号,后跟
字符

如果希望显示月份的三个字母名称,而不考虑区域设置,请选择“我们”作为格式化程序的区域设置:

NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[formatter setLocale:usLocale];

您看到此行为的原因是
MMM
格式是特定于语言环境的。在日本,它将月份格式化为月份编号,后跟
字符

如果希望显示月份的三个字母名称,而不考虑区域设置,请选择“我们”作为格式化程序的区域设置:

NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[formatter setLocale:usLocale];

你是在中国还是在日本跑步<代码>月
是“月”的符号,如果我没记错的话。@dasblinkenlight非常感谢。我想这就是问题所在。我告诉他,实际上是客户发的这个截图。他住在日本,所以我想这就是问题所在。再次感谢您在中国或日本地区跑步吗<代码>月
是“月”的符号,如果我没记错的话。@dasblinkenlight非常感谢。我想这就是问题所在。我告诉他,实际上是客户发的这个截图。他住在日本,所以我想这就是问题所在。再次感谢