首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在ios中集成条形图应用程序中的滑块控件

如何在ios中集成条形图应用程序中的滑块控件
EN

Stack Overflow用户
提问于 2012-11-12 15:07:27
回答 1查看 460关注 0票数 0

嗨,朋友们,我正在使用核心图标题创建条形图应用程序,我希望条形图使用滑块控件更改它们的值。所以我创建了滑块。滑块值已更改,但我的条形图没有更改。我不知道如何在条形图中整合滑块值。如果有人知道,请和我分享。我对此更有新鲜感。我的代码如下:我的滑块代码:

代码语言:javascript
运行
复制
-(void)updateSliderValueTo:(CGFloat)_value {

[sliderValue setText:[NSString stringWithFormat:@"%f", _value]];  }

我的条形图代码是:

代码语言:javascript
运行
复制
 - (id)init
{

self = [super init];

if(sliderValue == 0)
{

if (self) 
{
     //NSLog(@"sliderval :%d", sliderValue);
    // Setting up sample data here.
    sampleData = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:0],
                                                  [NSNumber numberWithInt:500], 
                                                  [NSNumber numberWithInt:1500], 
                                                  [NSNumber numberWithInt:2500], 
                                                  [NSNumber numberWithInt:3500], 
                                                  [NSNumber numberWithInt:4500], 
                                                  [NSNumber numberWithInt:5500],
                                                  [NSNumber numberWithInt:6500],
                                                  nil];

    sampleProduct = [[NSArray alloc] initWithObjects:@"", @"A", @"B", @"C", @"D", @"E",@"F",@"G",nil];

    // Initialize the currency formatter to support negative with the default currency style.
    currencyFormatter = [[NSNumberFormatter alloc] init];
    [currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
    [currencyFormatter setNegativePrefix:@"-"];
    [currencyFormatter setNegativeSuffix:@""];
}
}

else if(sliderValue != 0)
 {
   if(self)
   {
 sampleData = sliderValue; 
sampleProduct = [[NSArray alloc] initWithObjects:@"", @"A", @"B", @"C", @"D", @"E",@"F",@"G",nil];

    // Initialize the currency formatter to support negative with the default currency style.
    currencyFormatter = [[NSNumberFormatter alloc] init];
    [currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
    [currencyFormatter setNegativePrefix:@"-"];
    [currencyFormatter setNegativeSuffix:@""];
}
}
EN

Stack Overflow用户

发布于 2012-11-12 15:30:18

将初始化代码移动到buildGraph方法中,然后可以从iinit和所需的新IBAction (连接到滑块的a)调用该方法。

所以

代码语言:javascript
运行
复制
- (IBAction)onSliderChange {
     [self buildGraphData:self.slider.doubleValue]; //make the array with the new values
     [self.graph reloadData]; //you need this so CorePlot updates the specified graph view];
}
票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13339566

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档