From c88d93413af412d77f3661f36611e4bc6076f38e Mon Sep 17 00:00:00 2001 From: Deepwinter Date: Mon, 12 Mar 2012 02:43:57 -0700 Subject: [PATCH] Bug Fixes --- .../MapViewController.h | 1 + .../MapViewController.m | 68 +++++++++++-------- .../MapViewController.xib | 19 +++++- 3 files changed, 56 insertions(+), 32 deletions(-) diff --git a/Wildflowers of Detroit Iphone/MapViewController.h b/Wildflowers of Detroit Iphone/MapViewController.h index 8905942..31059ba 100644 --- a/Wildflowers of Detroit Iphone/MapViewController.h +++ b/Wildflowers of Detroit Iphone/MapViewController.h @@ -66,6 +66,7 @@ @property(strong, nonatomic) IBOutlet UIImageView * zoomView; @property(strong, nonatomic) IBOutlet TimelineVisualizationView * visualization; +@property(strong, nonatomic) IBOutlet UILabel * galleryHeading2; //detailView @property(strong, nonatomic) IBOutlet UILabel * detailDate; diff --git a/Wildflowers of Detroit Iphone/MapViewController.m b/Wildflowers of Detroit Iphone/MapViewController.m index e83f45b..b27f91f 100644 --- a/Wildflowers of Detroit Iphone/MapViewController.m +++ b/Wildflowers of Detroit Iphone/MapViewController.m @@ -24,6 +24,9 @@ #define insetLatitudeDelta .03 #define insetLongitudeDelta .03 +#define kLargeLatitudeDelta 1 +#define kLargeLongitudeDelta 1 + @@ -71,6 +74,7 @@ @implementation MapViewController @synthesize detailDate; @synthesize mapShowing; @synthesize heading2; +@synthesize galleryHeading2; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil @@ -104,18 +108,19 @@ - (void)viewDidLoad self.galleryScrollView.tag = kGalleryScrollViewTag; - - MKCoordinateRegion coordinateRegion; - CLLocationCoordinate2D center; - center.latitude = [RHSettings mapCenterLatitudeOnLoad]; - center.longitude = [RHSettings mapCenterLongitudeOnLoad]; - coordinateRegion.center = center; - MKCoordinateSpan span; - span.latitudeDelta = [RHSettings mapDeltaLatitudeOnLoad]; - span.longitudeDelta = [RHSettings mapDeltaLongitudeOnLoad]; - coordinateRegion.span = span; - self.mapView.region = coordinateRegion; - + if(!launchInGalleryMode) { + MKCoordinateRegion coordinateRegion; + CLLocationCoordinate2D center; + center.latitude = [RHSettings mapCenterLatitudeOnLoad]; + center.longitude = [RHSettings mapCenterLongitudeOnLoad]; + coordinateRegion.center = center; + MKCoordinateSpan span; + span.latitudeDelta = [RHSettings mapDeltaLatitudeOnLoad]; + span.longitudeDelta = [RHSettings mapDeltaLongitudeOnLoad]; + coordinateRegion.span = span; + self.mapView.region = coordinateRegion; + } + //spoof an overlay geometry WOverlay * overlay = [[WOverlay alloc] init]; @@ -226,13 +231,15 @@ - (void) addAnnotations { } else { documents = [MapDataModel getGalleryDocumentsWithStartKey:nil andLimit:nil]; } + + self.galleryHeading2.text = [NSString stringWithFormat:@"%i Images", [documents count]]; for( RhusDocument * document in documents){ CLLocationCoordinate2D coordinate; coordinate.latitude = [ (NSString*) [document objectForKey:@"latitude"] floatValue]; coordinate.longitude = [ (NSString*) [document objectForKey:@"longitude"] floatValue]; - RhusMapAnnotation * rhusMapAnnotation = [RhusMapAnnotation + RhusMapAnnotation * rhusMapAnnotation = (RhusMapAnnotation *) [RhusMapAnnotation mapAnnotationWithCoordinate: coordinate title: [document getDateString] subtitle: [document getReporter] @@ -297,14 +304,16 @@ -(void) mapToTimelineAnimation { [fullscreenTransitionDelegate subviewRequestingFullscreen]; - MKCoordinateRegion coordinateRegion = self.mapView.region; - MKCoordinateSpan span; - span.latitudeDelta = insetLatitudeDelta; - span.longitudeDelta = insetLongitudeDelta; - coordinateRegion.span = span; - self.mapView.region = coordinateRegion; - - [self setMapViewToInset]; + if(!launchInGalleryMode){ + MKCoordinateRegion coordinateRegion = self.mapView.region; + MKCoordinateSpan span; + span.latitudeDelta = insetLatitudeDelta; + span.longitudeDelta = insetLongitudeDelta; + coordinateRegion.span = span; + self.mapView.region = coordinateRegion; + + [self setMapViewToInset]; + } [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(placeMapInsetButton)]; @@ -373,8 +382,8 @@ -(void) transitionFromTimelineToMap{ MKCoordinateRegion coordinateRegion = self.mapView.region; MKCoordinateSpan span; - span.latitudeDelta = [RHSettings mapDeltaLatitudeOnLoad]; ; - span.longitudeDelta = [RHSettings mapDeltaLongitudeOnLoad]; ; + span.latitudeDelta = kLargeLatitudeDelta; + span.longitudeDelta = kLargeLongitudeDelta; coordinateRegion.span = span; self.mapView.region = coordinateRegion; @@ -459,6 +468,7 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *) control { [self centerMapOnCoodinates:view.annotation.coordinate]; - [self transitionFromMapToTimelineWithIndex:view.tag andTimeline:nil ]; + NSInteger tag = view.tag; + [self transitionFromMapToTimelineWithIndex:tag andTimeline:nil ]; [mapView deselectAnnotation:view.annotation animated:YES]; } @@ -598,14 +609,12 @@ - (IBAction)didTouchThumbnail:(id)sender{ int tag = senderButton.tag; self.currentDetailIndex = tag; - //place detail scroll view + //place zoom view CGRect frame; frame.origin.x = senderOrigin.x; frame.origin.y = senderOrigin.y ; - // + (kThumbnailHeight - kThumbnailWidth * 320 / 480) / 2; // this term is the vert offset of the actual image frame.size.width = kThumbnailWidth; - frame.size.height = frame.size.width; // 320 * kThumbnailWidth / 480; - + frame.size.height = frame.size.width; // 320 * kThumbnailWidth / 480; self.zoomView.frame = frame; [self.timelineView insertSubview:self.zoomView belowSubview:self.timelineControlsView]; @@ -617,7 +626,7 @@ - (IBAction)didTouchThumbnail:(id)sender{ //animate the zoom in, making the detail scroll view fill the screen - [UIView beginAnimations:nil context:NULL]; + [UIView beginAnimations:@"Anim" context:NULL]; [UIView setAnimationDuration: 0.50]; [fullscreenTransitionDelegate subviewRequestingFullscreen]; @@ -715,6 +724,7 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { //async load next gallery page of data! currentGalleryPage = page; + RhusDocument * document = [activeDocuments objectAtIndex:currentDetailIndex]; [self centerMapAtLatitude:[document getLatitude] andLongitude:[document getLongitude]]; if(!launchInGalleryMode){ // self.heading2.text = [document objectForKey: diff --git a/Wildflowers of Detroit Iphone/MapViewController.xib b/Wildflowers of Detroit Iphone/MapViewController.xib index 6a8af7c..d08af2e 100644 --- a/Wildflowers of Detroit Iphone/MapViewController.xib +++ b/Wildflowers of Detroit Iphone/MapViewController.xib @@ -401,7 +401,7 @@ 292 - {{125, 14}, {107, 21}} + {{125, 14}, {107, 22}} @@ -410,7 +410,7 @@ 7 NO IBCocoaTouchFramework - Month + March 2012 1 MC44NDY0NDM0NzQzIDAuNDE1Nzg1MjUzIDAuMjI4OTcyNDQ5OQA @@ -982,6 +982,14 @@ 102 + + + galleryHeading2 + + + + 103 + delegate @@ -1427,7 +1435,7 @@ - 102 + 103 @@ -1493,6 +1501,7 @@ UILabel UIScrollView UIView + UILabel UIScrollView UILabel UIView @@ -1523,6 +1532,10 @@ detailView UIView + + galleryHeading2 + UILabel + galleryScrollView UIScrollView