1

棒グラフの描画にコアプロットを使用しています。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では、日付に奇妙な文字が表示されます(上記でフォーマットしました)。この画像を参照してください:

ここに画像の説明を入力してください

4

1 に答える 1

1
于 2012-04-25T16:11:05.700 に答える