【代碼筆記】豎狀圖,代碼筆記
一,。
二,工程圖。
三,代碼。
RootViewController.h
#import <UIKit/UIKit.h>@interface RootViewController : UIViewController@end
RootViewController.m
#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]; }