一,效果图。

【代码笔记】iOS-竖状图

二,工程图。

【代码笔记】iOS-竖状图

三,代码。

RootViewController.h

#import <UIKit/UIKit.h>

@interface RootViewController : UIViewController

@end

 

RootViewController.m

【代码笔记】iOS-竖状图
#import "RootViewController.h"
//加入头文件
#import "NTChartView.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    self.title=@"竖状图";
    
    
    NTChartView *v = [[NTChartView alloc] initWithFrame:CGRectMake(10, 100, 300, 300)];
    
    NSArray *g = [NSArray arrayWithObject:[NSMutableArray arrayWithObjects:
                                           [NSNumber numberWithFloat:18],
                                           [NSNumber numberWithFloat:30],
                                           [NSNumber numberWithFloat:16.5],
                                           [NSNumber numberWithFloat:55],
                                           [NSNumber numberWithFloat:40],nil]];
    v.groupData = g;
    
    [self.view addSubview:v];

    
}
【代码笔记】iOS-竖状图

 

相关文章: