- (void)viewDidLoad
{
graph = [[CPTXYGraph alloc] initWithFrame: self.view.bounds];
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
hostingView.hostedGraph = graph;
CPTPieChart *pieChart = [[CPTPieChart alloc] init];
pieChart.dataSource = self;
pieChart.pieRadius = 100.0;
pieChart.identifier = @"PieChart1";
pieChart.startAngle = M_PI_4;
pieChart.sliceDirection = CPTPieDirectionCounterClockwise;
self.pieData= [NSMutableArray arrayWithObjects:[NSNumber numberWithDouble:90.0],
[NSNumber numberWithDouble:20.0],
[NSNumber numberWithDouble:30.0],
[NSNumber numberWithDouble:40.0],
[NSNumber numberWithDouble:50.0],
[NSNumber numberWithDouble:60.0], nil];
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
[graph applyTheme:theme];
[graph addPlot:pieChart];
[pieChart release];
}
Я нашел этот код в сети. Этот код работает нормально, но я получаю два предупреждения на
pieChart.dataSource = self;
В нем говорится.
предупреждение: класс 'SOTC_CorePlotExampleViewController' не реализует протокол 'CPTPlotDataSource'
предупреждение: семантическая проблема: присвоение 'id' несовместимого типа 'SOTC_CorePlotExampleViewController *'