Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepwinter committed Mar 12, 2012
1 parent 51fdc04 commit c88d934
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 32 deletions.
1 change: 1 addition & 0 deletions Wildflowers of Detroit Iphone/MapViewController.h
Expand Up @@ -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;
Expand Down
68 changes: 39 additions & 29 deletions Wildflowers of Detroit Iphone/MapViewController.m
Expand Up @@ -24,6 +24,9 @@

#define insetLatitudeDelta .03
#define insetLongitudeDelta .03
#define kLargeLatitudeDelta 1
#define kLargeLongitudeDelta 1




Expand Down Expand Up @@ -71,6 +74,7 @@ @implementation MapViewController
@synthesize detailDate;
@synthesize mapShowing;
@synthesize heading2;
@synthesize galleryHeading2;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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)];
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -459,6 +468,7 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnno

annotationView.leftCalloutAccessoryView = calloutButton;
annotationView.canShowCallout = YES;
annotationView.tag = rhusMapAnnotation.tag;

return annotationView;
}
Expand All @@ -471,7 +481,8 @@ - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id < MKOverlay >
- (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];
}

Expand Down Expand Up @@ -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];
Expand All @@ -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];
Expand Down Expand Up @@ -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:
Expand Down
19 changes: 16 additions & 3 deletions Wildflowers of Detroit Iphone/MapViewController.xib
Expand Up @@ -401,7 +401,7 @@
<object class="IBUILabel" id="940329440">
<reference key="NSNextResponder" ref="490449960"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{125, 14}, {107, 21}}</string>
<string key="NSFrame">{{125, 14}, {107, 22}}</string>
<reference key="NSSuperview" ref="490449960"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="642578738"/>
Expand All @@ -410,7 +410,7 @@
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Month</string>
<string key="IBUIText">March 2012</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44NDY0NDM0NzQzIDAuNDE1Nzg1MjUzIDAuMjI4OTcyNDQ5OQA</bytes>
Expand Down Expand Up @@ -982,6 +982,14 @@
</object>
<int key="connectionID">102</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">galleryHeading2</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="642578738"/>
</object>
<int key="connectionID">103</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
Expand Down Expand Up @@ -1427,7 +1435,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">102</int>
<int key="maxID">103</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down Expand Up @@ -1493,6 +1501,7 @@
<string key="detailDate">UILabel</string>
<string key="detailScrollView">UIScrollView</string>
<string key="detailView">UIView</string>
<string key="galleryHeading2">UILabel</string>
<string key="galleryScrollView">UIScrollView</string>
<string key="heading2">UILabel</string>
<string key="infoView">UIView</string>
Expand Down Expand Up @@ -1523,6 +1532,10 @@
<string key="name">detailView</string>
<string key="candidateClassName">UIView</string>
</object>
<object class="IBToOneOutletInfo" key="galleryHeading2">
<string key="name">galleryHeading2</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo" key="galleryScrollView">
<string key="name">galleryScrollView</string>
<string key="candidateClassName">UIScrollView</string>
Expand Down

0 comments on commit c88d934

Please sign in to comment.