File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -628,6 +628,15 @@ -(void)insertDataAtIndex:(NSUInteger)idx numberOfRecords:(NSUInteger)numberOfRec
628
628
}
629
629
}
630
630
631
+ CPTMutableAnnotationArray *labelArray = self.labelAnnotations ;
632
+ if ( labelArray ) {
633
+ id nullObject = [NSNull null ];
634
+ NSUInteger lastIndex = idx + numberOfRecords - 1 ;
635
+ for ( NSUInteger i = idx; i <= lastIndex; i++ ) {
636
+ [labelArray insertObject: nullObject atIndex: i];
637
+ }
638
+ }
639
+
631
640
self.cachedDataCount += numberOfRecords;
632
641
[self reloadDataInIndexRange: NSMakeRange (idx, numberOfRecords)];
633
642
}
@@ -659,8 +668,20 @@ -(void)deleteDataInIndexRange:(NSRange)indexRange
659
668
}
660
669
}
661
670
671
+ CPTMutableAnnotationArray *labelArray = self.labelAnnotations ;
672
+
673
+ NSUInteger maxIndex = NSMaxRange (indexRange);
674
+ Class annotationClass = [CPTAnnotation class ];
675
+
676
+ for ( NSUInteger i = indexRange.location ; i < maxIndex; i++ ) {
677
+ CPTAnnotation *annotation = labelArray[i];
678
+ if ( [annotation isKindOfClass: annotationClass] ) {
679
+ [self removeAnnotation: annotation];
680
+ }
681
+ }
682
+ [labelArray removeObjectsInRange: indexRange];
683
+
662
684
self.cachedDataCount -= indexRange.length ;
663
- [self relabelIndexRange: NSMakeRange (indexRange.location, self .cachedDataCount - indexRange.location)];
664
685
[self setNeedsDisplay ];
665
686
}
666
687
You can’t perform that action at this time.
0 commit comments