Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

gcd added

  • Loading branch information...
commit 1f7e36adb20644b4b80eb63376b33440c58f47bf 1 parent 6b85c10
@bitey bitey authored
Showing with 15 additions and 5 deletions.
  1. +15 −5 MappingMashupApp/FlickrMapViewController.m
View
20 MappingMashupApp/FlickrMapViewController.m
@@ -43,7 +43,7 @@ @interface FlickrMapViewController ()
@implementation FlickrMapViewController
@synthesize managedObjectContext;
-
+dispatch_queue_t newQueue;
- (void)viewDidLoad
{
@@ -261,6 +261,7 @@ -(void) addPhotosToMap: (NSMutableArray*)photosArray
-(MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
+ newQueue = dispatch_queue_create("com.thePeanutGallery.maskGCDTest", NULL);
UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"myAnnotation"];
@@ -281,9 +282,18 @@ -(MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id<MKAnnotati
NSData *photoData = [NSData dataWithContentsOfURL:flickrThumbnailURL];
UIImage *photoThumbnailImage = [UIImage imageWithData:photoData];
//Now mask the image
-
- UIImage * mask = [UIImage imageNamed:@"circleMask.png"];
- UIImage *maskedAnnotationImage = [self createMaskWith:mask onImage:photoThumbnailImage];
+
+ dispatch_async(newQueue,^void(void)
+ {
+ UIImage * mask = [UIImage imageNamed:@"circleMask.png"];
+ UIImage *maskedAnnotationImage = [self createMaskWith:mask onImage:photoThumbnailImage];
+ dispatch_async(dispatch_get_main_queue(),^void (void)
+ {
+ annotationView.image = maskedAnnotationImage;
+ });
+
+ });
+
//Add the shine - can do later
// UIImage *backgroundImage = maskedAnnotationImage;
@@ -306,7 +316,7 @@ -(MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id<MKAnnotati
annotationView.leftCalloutAccessoryView = leftCAV;
- annotationView.image = maskedAnnotationImage;
+ //annotationView.image = maskedAnnotationImage;
annotationView.rightCalloutAccessoryView = detailButton;
Please sign in to comment.
Something went wrong with that request. Please try again.