Skip to content

Commit

Permalink
Merge pull request #6 from interlock/master
Browse files Browse the repository at this point in the history
Conditional ARC support
  • Loading branch information
RVLVR committed Mar 18, 2012
2 parents 429f99a + ef0af14 commit f24a90d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion REVClusterMap/REVClusterMap/REVAnnotationsCollection.m
Expand Up @@ -44,10 +44,11 @@ - (NSUInteger) count
return [collection count]; return [collection count];
} }



#if !__has_feature(objc_arc)
-(void)dealloc -(void)dealloc
{ {
[collection release], collection = nil; [collection release], collection = nil;
[super dealloc]; [super dealloc];
} }
#endif
@end @end
7 changes: 6 additions & 1 deletion REVClusterMap/REVClusterMap/REVClusterBlock.m
Expand Up @@ -40,8 +40,11 @@ - (void) addAnnotation:(id<MKAnnotation>)annotation
double y = [annotationsCollection ySum] / [annotationsCollection count]; double y = [annotationsCollection ySum] / [annotationsCollection count];


CLLocationCoordinate2D location = MKCoordinateForMapPoint(MKMapPointMake(x, y)); CLLocationCoordinate2D location = MKCoordinateForMapPoint(MKMapPointMake(x, y));

#if !__has_feature(objc_arc)
REVClusterPin *pin = [[[REVClusterPin alloc] init] autorelease]; REVClusterPin *pin = [[[REVClusterPin alloc] init] autorelease];
#else
REVClusterPin *pin = [[REVClusterPin alloc] init];
#endif
pin.coordinate = location; pin.coordinate = location;
pin.nodes = [annotationsCollection collection]; pin.nodes = [annotationsCollection collection];
return pin; return pin;
Expand All @@ -60,10 +63,12 @@ - (NSString*) description
return [NSString stringWithFormat:@"%i annotations",[self count]]; return [NSString stringWithFormat:@"%i annotations",[self count]];
} }


#if !__has_feature(objc_arc)
- (void) dealloc - (void) dealloc
{ {
[annotationsCollection release], annotationsCollection = nil; [annotationsCollection release], annotationsCollection = nil;
[super dealloc]; [super dealloc];
} }
#endif


@end @end
2 changes: 2 additions & 0 deletions REVClusterMap/REVClusterMap/REVClusterManager.m
Expand Up @@ -63,7 +63,9 @@ + (NSArray *) clusterAnnotationsForMapView:(MKMapView *)mapView forAnnotations:(
{ {
REVClusterBlock *block = [[REVClusterBlock alloc] init]; REVClusterBlock *block = [[REVClusterBlock alloc] init];
[clusteredBlocks addObject:block]; [clusteredBlocks addObject:block];
#if !__has_feature(objc_arc)
[block release]; [block release];
#endif
} }


for (REVClusterPin *pin in visibleAnnotations) for (REVClusterPin *pin in visibleAnnotations)
Expand Down
4 changes: 4 additions & 0 deletions REVClusterMap/REVClusterMap/REVClusterMapView.m
Expand Up @@ -56,11 +56,13 @@ - (void) setup
zoomLevel = self.visibleMapRect.size.width * self.visibleMapRect.size.height; zoomLevel = self.visibleMapRect.size.width * self.visibleMapRect.size.height;
} }


#if !__has_feature(objc_arc)
- (void)dealloc - (void)dealloc
{ {
[annotationsCopy release]; [annotationsCopy release];
[super dealloc]; [super dealloc];
} }
#endif


-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay -(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay
{ {
Expand Down Expand Up @@ -221,7 +223,9 @@ - (BOOL) mapViewDidZoom


- (void) addAnnotations:(NSArray *)annotations - (void) addAnnotations:(NSArray *)annotations
{ {
#if !__has_feature(objc_arc)
[annotationsCopy release]; [annotationsCopy release];
#endif
annotationsCopy = [annotations copy]; annotationsCopy = [annotations copy];


NSArray *add = [REVClusterManager clusterAnnotationsForMapView:self forAnnotations:annotations blocks:self.blocks minClusterLevel:self.minimumClusterLevel]; NSArray *add = [REVClusterManager clusterAnnotationsForMapView:self forAnnotations:annotations blocks:self.blocks minClusterLevel:self.minimumClusterLevel];
Expand Down
3 changes: 3 additions & 0 deletions REVClusterMap/REVClusterMap/REVClusterPin.m
Expand Up @@ -22,11 +22,14 @@ - (NSUInteger) nodeCount
return 0; return 0;
} }


#if !__has_feature(objc_arc)
- (void)dealloc - (void)dealloc
{ {
[title release]; [title release];
[subtitle release]; [subtitle release];
[nodes release]; [nodes release];
[super dealloc]; [super dealloc];
} }
#endif

@end @end

0 comments on commit f24a90d

Please sign in to comment.