Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.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
如何在iphone应用程序中在图形值的y轴上显示$符号_Iphone_Graph_String Formatting - Fatal编程技术网

如何在iphone应用程序中在图形值的y轴上显示$符号

如何在iphone应用程序中在图形值的y轴上显示$符号,iphone,graph,string-formatting,Iphone,Graph,String Formatting,我有一个图表,显示给定的百分比登录值,但我希望代码中的$改为$,但它也隐藏了所有的值 -(void)drawHistogramWithItem:(ECGraphItem *)item index:(int)index color:(UIColor *)color { if (index != 0) _histogramStartX += _histogramSpacing + item.width; CGRect rect = CGRectMake(_histogra

我有一个图表,显示给定的百分比登录值,但我希望代码中的$改为$,但它也隐藏了所有的值

     -(void)drawHistogramWithItem:(ECGraphItem *)item index:(int)index color:(UIColor *)color
    {
if (index != 0) 
    _histogramStartX += _histogramSpacing + item.width;
CGRect rect = CGRectMake(_histogramStartX, _xaxisStart.y - _ySpacingScale*item.yValue,item.width, _ySpacingScale*item.yValue);
[color setFill];
[[UIColor blackColor] setStroke];
CGContextAddRect(_context,rect);
CGContextDrawPath(_context, kCGPathFillStroke);
[[UIColor blackColor] set];
NSString *percentage = [NSString stringWithFormat:@"%.1f%%",item.yValue];

[percentage drawAtPoint:CGPointMake(_histogramStartX,_xaxisStart.y - _ySpacingScale*item.yValue - 15) withFont:[UIFont boldSystemFontOfSize:10]];
[self drawWords:item.name AtPoint:CGPointMake(_histogramStartX + item.width/8 ,_xaxisStart.y + 5)  color:[UIColor blackColor]];
    }
只要改变这一点:

NSString *percentage = [NSString stringWithFormat:@"%.1f%%",item.yValue];
为此:

NSString *percentage = [NSString stringWithFormat:@"%.1f$",item.yValue];

它应该会起作用。希望有帮助

您是否尝试过此
NSString*percentage=[NSString stringWithFormat:@“%.1f$”,item.yValue]或<代码>NSString*百分比=[NSString stringWithFormat:@“$%.1f”,item.yValue]