[Reading Notes] pie chart, Reading Notes
I ,.
2. Engineering Drawing.
3. Code.
RootViewController. h
#import <UIKit/UIKit.h>@class QuizChartView;@interface RootViewController : UIViewController{ QuizChartView *m_chartView;}
RootViewController. m
# Import "RootViewController. h "// Add the header file # import" QuizChartView. h "@ interface RootViewController () @ end @ implementation RootViewController-(id) initWithNibName :( NSString *) bundle :( NSBundle *) handle {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization} return self;}-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // initialize the background image [self addView]; // initialize the pie chart [self addChartView];} # pragma-mark-functions // display the background image-(void) addView {self. title = @ "Pie Chart";} // Add a chart-(void) addChartView {m_chartView = [[QuizChartView alloc] initWithFrame: CGRectMake (10, 70,300,300)]; m_chartView.backgroundColor = [UIColor orangeColor]; m_chartView.m_aPercent = [NSMutableArray arrayWithObjects: @ "10", @ "20", @ "30", @ "40", nil]; m_chartView.m_aHint = [NSMutableArray arrayWithObjects: @ "Breakfast", @ "lunch", @ "dinner", @ "Supper", nil]; [self. view addSubview: m_chartView];}