0

我在头文件中创建了一个视图。还要在头文件中导入 BarChartView。

@property (weak, nonatomic) IBOutlet JBBarChartView *barChartView;

- (void)viewDidLoad
{
JBBarChartView *barChartView = [[JBBarChartView alloc] init];
barChartView.dataSource = self;
barChartView.delegate = self;
[self addSubview:barChartView];
}

我添加了一些将属性赋予 JBBarChart 的内置方法

   - (UIColor *)barSelectionColorForBarChartView:(JBBarChartView *)barChartView
{
    return [UIColor greenColor]; // color of selection view
}
- (BOOL)slideNavigationControllerShouldDisplayLeftMenu
{
    return YES;
}
- (UIColor *)barChartView:(JBBarChartView *)barChartView colorForBarViewAtIndex:(NSUInteger)index
{
    return [UIColor greenColor];
}

- (NSUInteger)numberOfBarsInBarChartView:(JBBarChartView *)barChartView
{
    return 4;
}
- (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSUInteger)index
{
    return 100.0;
}

任何帮助将不胜感激,视图中仍然没有任何内容

4

1 回答 1

0

只需要更新一行

- (void)viewDidLoad
{
JBBarChartView *barChartView = [[JBBarChartView alloc] init];
barChartView.dataSource = self;
barChartView.delegate = self;
[self.view addSubview:barChartView];//Update this line
}
于 2016-11-03T15:09:11.243 回答