Я пытаюсь наложить несколько графиков на одном графике, и я получаю аварии (EXC_BAD_ACCESS) на рисунке CPTScatterPlotDelegate в классе CPTScatterPlot.mаварии на CPTScatterPlotDelegate в CorePlot
-(void)renderAsVectorInContext:(nonnull CGContextRef)context {
...
// Draw line
if (theLineStyle) {
CGPathRef dataLinePath = [self newDataLinePathForViewPoints:viewPoints indexRange:viewIndexRange baselineYValue:CPTNAN];
// Give the delegate a chance to prepare for the drawing.
id<CPTScatterPlotDelegate> theDelegate = self.delegate;
....
}
...
}
То же самое в CPTLegendDelegate в классе CPTPlot. м
-(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(nonnull CGContextRef)context
{
id<CPTLegendDelegate> theDelegate = (id<CPTLegendDelegate>)self.delegate;
...
}
Я использую CorePlot 2,1, и я модифицировал renderInGraphHostingView в файле SimpleScatterPlot.m в примерах/CorePlotGallery следующим образом:
-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated {
...
static CPTGraph *graph = nil;
if(initialize) {
graph = [[CPTXYGraph alloc] initWithFrame:bounds];
...
}
[self addGraph:graph toHostingView:hostingView];
theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
...
}
Поэтому каждый раз, когда я хочу нарисовать новую строку данных, я использую тот же граф.
Проблема случайная, а иногда и сбой программы, когда я рисую вторую строку, иногда в третьей, но она всегда отлично работает для первого графика. Это также зависит от компиляции. Любые идеи? Спасибо, в Advance
Эрик, спасибо, что я случайно создал несколько экземпляров класса SimpleScatterPlot каждый раз, когда я пытался создать новый график. –