Created
October 18, 2013 01:33
-
-
Save jerryhjones/7035129 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)configureWithVenue:(Venue *)venue | |
{ | |
self.venueName = venue.name; | |
self.addressLabel.text = [venue.address fullAddressWithMultipleLines:YES includeCountry:NO]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
if(nil == self.mapView) { | |
MKMapView *mapView = [[MKMapView alloc] initWithFrame:self.mapViewContainer.bounds]; | |
self.mapView = mapView; | |
[self.mapViewContainer addSubview:mapView]; | |
} | |
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake([venue.latitude doubleValue], [venue.longitude doubleValue]); | |
MKCoordinateRegion region; | |
region.center = coordinate; | |
region.span = MKCoordinateSpanMake(1.0f/69.0f, 1.0f/69.0f); | |
[self.mapView setRegion:region]; | |
//Offset map's center | |
CLLocationCoordinate2D center = coordinate; | |
center.latitude -= (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 1.0f / 700.0f : 1.0f / -700.0f; | |
center.longitude -= 1.0f / 130.0f; | |
[self.mapView setCenterCoordinate:center]; | |
self.mapView.userInteractionEnabled = NO; | |
GSAnnotation *annotaton = [venue mapAnnotation]; | |
if (annotaton) { | |
[self.mapView addAnnotation:annotaton]; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment