Permalink
Browse files

Loading screen, refresh button, map overlays implemented

  • Loading branch information...
1 parent 633a7e0 commit 0a23fe3ec526b7614ed384beb413952e7c0c340f @xirianlight xirianlight committed Mar 25, 2013
@@ -21,6 +21,7 @@
83B0D00A16FA1A8900C9D8F8 /* HistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83B0D00916FA1A8900C9D8F8 /* HistoryViewController.m */; };
83BB6B6B16FA0A31003A4506 /* circleMask6464.png in Resources */ = {isa = PBXBuildFile; fileRef = 83BB6B6A16FA0A31003A4506 /* circleMask6464.png */; };
83BB6B6E16FA0A64003A4506 /* circleMask6464@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83BB6B6D16FA0A64003A4506 /* circleMask6464@2x.png */; };
+ 83D7203716FF964A0012A0B0 /* loadingPage.png in Resources */ = {isa = PBXBuildFile; fileRef = 83D7203616FF964A0012A0B0 /* loadingPage.png */; };
83D97AF416FB859C00B525E2 /* circleMask@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83D97AF316FB859C00B525E2 /* circleMask@2x.png */; };
83D97AF616FB872000B525E2 /* circleMaskShine@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83D97AF516FB872000B525E2 /* circleMaskShine@2x.png */; };
83E3AE9016FA687A00A8F27E /* webviewpopout_shelf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83E3AE8F16FA687A00A8F27E /* webviewpopout_shelf@2x.png */; };
@@ -95,6 +96,7 @@
83BB6B6A16FA0A31003A4506 /* circleMask6464.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = circleMask6464.png; sourceTree = "<group>"; };
83BB6B6D16FA0A64003A4506 /* circleMask6464@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "circleMask6464@2x.png"; sourceTree = "<group>"; };
83BB6B6F16FA0B1A003A4506 /* RossScratchpad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RossScratchpad.h; sourceTree = "<group>"; };
+ 83D7203616FF964A0012A0B0 /* loadingPage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = loadingPage.png; sourceTree = "<group>"; };
83D97AF316FB859C00B525E2 /* circleMask@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "circleMask@2x.png"; sourceTree = "<group>"; };
83D97AF516FB872000B525E2 /* circleMaskShine@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "circleMaskShine@2x.png"; path = "MappingMashupApp/circleMaskShine@2x.png"; sourceTree = "<group>"; };
83E3AE8F16FA687A00A8F27E /* webviewpopout_shelf@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "webviewpopout_shelf@2x.png"; sourceTree = "<group>"; };
@@ -298,6 +300,7 @@
8F3AD83816F90A0300BEEB3A /* Custom Images */ = {
isa = PBXGroup;
children = (
+ 83D7203616FF964A0012A0B0 /* loadingPage.png */,
83D97AF516FB872000B525E2 /* circleMaskShine@2x.png */,
83D97AF316FB859C00B525E2 /* circleMask@2x.png */,
83E3AE8F16FA687A00A8F27E /* webviewpopout_shelf@2x.png */,
@@ -422,6 +425,7 @@
83E3AE9016FA687A00A8F27E /* webviewpopout_shelf@2x.png in Resources */,
83D97AF416FB859C00B525E2 /* circleMask@2x.png in Resources */,
83D97AF616FB872000B525E2 /* circleMaskShine@2x.png in Resources */,
+ 83D7203716FF964A0012A0B0 /* loadingPage.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -32,6 +32,7 @@ @interface FlickrMapViewController ()
NSString * photoThumbnailStringToPass;
__weak IBOutlet MKMapView *mapView;
+ __weak IBOutlet UIView *loadingOverlay;
}
@@ -48,7 +49,7 @@ - (void)viewDidLoad
[self startLocationUpdates];
//Add refresh button to Bookmarks viewController --CURRENTLY GOES TO BOOKMARKS, NEED TO WRITE METHOD FOR THIS
- self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(bookmarkButtonPressed)];
+ self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refreshButtonPressed)];
//Add bookmarks button to viewController
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(bookmarkButtonPressed)];
@@ -64,6 +65,21 @@ - (void)viewDidLoad
locationManager = appDelegate.locationManager;
[mapView setShowsUserLocation:YES];
+ //Overlay activate
+ // Define an overlay that covers Colorado.
+// MKCircle *overlay = [MKCircle circleWithCenterCoordinate:mapView.centerCoordinate radius:1000];
+ CLLocationCoordinate2D mobileMakers = {
+ .latitude = 41.894032,
+ .longitude = -87.63472
+ };
+ MKCircle *overlay = [MKCircle circleWithCenterCoordinate:mobileMakers radius:100000];
+
+
+ overlay.title = @"Current region";
+
+ [mapView addOverlay:overlay];
+
+
APIManager *mrAPIManager = [[APIManager alloc] initWithYelpSearch:@"free%20wifi" andLocation:missLocationManager];
//deleagtion begins
@@ -281,6 +297,11 @@ -(MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id<MKAnnotati
return nil;
}
+ //Maybe stop loading scren here?
+ [UIView animateWithDuration:2 animations:^(void) {
+ loadingOverlay.alpha = 0;}];
+
+
return annotationView;
}
@@ -302,6 +323,24 @@ - (UIImage*) createMaskWith: (UIImage *)maskImage onImage:(UIImage*) subjectImag
return finalImage;
}
+//Method for creating a map overlay
+- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay
+{
+ if ([overlay isKindOfClass:[MKCircle class]])
+ {
+ MKCircleView* aView = [[MKCircleView alloc] initWithCircle:(MKCircle *)overlay];
+
+ aView.fillColor = [[UIColor blackColor] colorWithAlphaComponent:0.8];
+ aView.strokeColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
+ aView.lineWidth = 1;
+
+ return aView;
+ }
+
+ return nil;
+}
+
+
# pragma mark - User Actions
//
// User selects an annotation
@@ -344,6 +383,14 @@ - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view cal
}
+-(void)refreshButtonPressed
+{
+ [mapView removeAnnotations : mapView.annotations ];
+ [UIView animateWithDuration:0.5 animations:^(void) {
+ loadingOverlay.alpha = 1;}];
+ [self viewDidLoad];
+}
+
# pragma mark - Transitions
@@ -99,6 +99,12 @@ - (void)viewDidLoad
//This may break the view (trying to draw custom annotation for this origin Photo pin.
selectedAnnotation = originAnnotation;
+ //Darkening overlay on map, if we want one
+ MKCircle *overlay = [MKCircle circleWithCenterCoordinate:originLocationCoordinate radius:100000];
+ overlay.title = @"Current region";
+ //[yelpMapView addOverlay:overlay];
+
+
[yelpMapView setRegion:originRegion animated:YES];
[yelpMapView addAnnotation:originAnnotation];
@@ -253,6 +259,34 @@ -(MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id<MKAnnotati
UIImage *photoThumbnailImage = [UIImage imageWithData:photoData];
annotationView.image = photoThumbnailImage;
+ UIImage * mask = [UIImage imageNamed:@"circleMask.png"];
+ UIImage *maskedAnnotationImage = [self createMaskWith:mask onImage:photoThumbnailImage];
+
+ //Add the shine - can do later
+ // UIImage *backgroundImage = maskedAnnotationImage;
+ // UIImage *watermarkImage = [UIImage imageNamed:@"circleMaskShine"];
+ //
+ // UIGraphicsBeginImageContext(backgroundImage.size);
+ // [backgroundImage drawInRect:CGRectMake(0, 0, backgroundImage.size.width, backgroundImage.size.height)];
+ // [watermarkImage drawInRect:CGRectMake(backgroundImage.size.width - watermarkImage.size.width, backgroundImage.size.height - watermarkImage.size.height, watermarkImage.size.width, watermarkImage.size.height)];
+ // UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
+ // UIGraphicsEndImageContext();
+
+ //Set the imageView inside the
+ UIImageView *photoContainer = [[UIImageView alloc] initWithImage:photoThumbnailImage];
+
+ photoContainer.contentMode = UIViewContentModeScaleAspectFit;
+
+ UIView *leftCAV = [[UIView alloc] initWithFrame:CGRectMake(0,0,32,32)];
+ leftCAV.clipsToBounds = YES;
+ [leftCAV addSubview : photoContainer];
+
+ annotationView.leftCalloutAccessoryView = leftCAV;
+
+ annotationView.image = maskedAnnotationImage;
+ annotationView.rightCalloutAccessoryView = detailButton;
+ annotationView.alpha = 0.33;
+
return annotationView;
}
@@ -272,6 +306,23 @@ -(MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id<MKAnnotati
return annotationView;
}
+//Method for creating a map overlay
+- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay
+{
+ if ([overlay isKindOfClass:[MKCircle class]])
+ {
+ MKCircleView* aView = [[MKCircleView alloc] initWithCircle:(MKCircle *)overlay];
+
+ aView.fillColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
+ aView.strokeColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
+ aView.lineWidth = 1;
+
+ return aView;
+ }
+
+ return nil;
+}
+
# pragma mark - User Actions
//
// User selects an annotation
@@ -326,7 +377,24 @@ - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *
}
-
+//Masking method
+- (UIImage*) createMaskWith: (UIImage *)maskImage onImage:(UIImage*) subjectImage
+{
+ CGImageRef maskRef = maskImage.CGImage;
+ CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
+ CGImageGetHeight(maskRef),
+ CGImageGetBitsPerComponent(maskRef),
+ CGImageGetBitsPerPixel(maskRef),
+ CGImageGetBytesPerRow(maskRef),
+ CGImageGetDataProvider(maskRef),
+ NULL,
+ false);
+
+ CGImageRef masked = CGImageCreateWithMask(subjectImage.CGImage, mask);
+
+ UIImage *finalImage = [UIImage imageWithCGImage:masked];
+ return finalImage;
+}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="12C60" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="mW4-IJ-E2e">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="12D78" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="mW4-IJ-E2e">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/>
</dependencies>
@@ -47,11 +47,34 @@
<outlet property="delegate" destination="L5I-mE-d7D" id="xGQ-az-UrA"/>
</connections>
</mapView>
+ <view contentMode="scaleToFill" id="QIi-SX-ZAA">
+ <rect key="frame" x="0.0" y="-64" width="325" height="568"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="loadingPage.png" id="D5k-eU-WtS">
+ <rect key="frame" x="0.0" y="51.5" width="320" height="568"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ </imageView>
+ <activityIndicatorView opaque="NO" contentMode="scaleToFill" animating="YES" style="whiteLarge" id="BDR-6h-3HL">
+ <rect key="frame" x="144" y="362" width="37" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ </activityIndicatorView>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Experience your surroundings. Tap something interesting and we'll show you where you can get online" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="GWX-UP-W0P">
+ <rect key="frame" x="20" y="429" width="285" height="91"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" title="Wi-Where" id="UUg-sh-XIb"/>
<connections>
+ <outlet property="loadingOverlay" destination="QIi-SX-ZAA" id="TsT-yj-EFc"/>
<outlet property="mapView" destination="7uf-B3-ybP" id="qbj-0f-eqs"/>
<segue destination="2" kind="push" identifier="toYelpMapView" id="yxN-ze-z9q"/>
<segue destination="jTz-JW-Bre" kind="push" identifier="toBookmarksAndHistory" id="Th0-2G-EcE"/>
@@ -66,11 +89,11 @@
<objects>
<viewController id="qVE-kj-ncM" customClass="YelpWebPageBrowser" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="wEa-dC-5Et">
- <rect key="frame" x="0.0" y="64" width="320" height="504"/>
+ <rect key="frame" x="0.0" y="64" width="320" height="455"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<webView contentMode="scaleToFill" id="tBs-TS-l6k">
- <rect key="frame" x="0.0" y="0.0" width="320" height="504"/>
+ <rect key="frame" x="0.0" y="0.0" width="320" height="455"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<gestureRecognizers/>
<connections>
@@ -275,6 +298,7 @@
</scene>
</scenes>
<resources>
+ <image name="loadingPage.png" width="640" height="1136"/>
<image name="webviewpopout_shelf@2x.png" width="640" height="94"/>
</resources>
<classes>
@@ -284,6 +308,8 @@
<class className="FlickrMapViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/FlickrMapViewController.h"/>
<relationships>
+ <relationship kind="action" name="backToFlickrMapView:" candidateClass="UIStoryboardSegue"/>
+ <relationship kind="outlet" name="loadingOverlay" candidateClass="UIView"/>
<relationship kind="outlet" name="mapView" candidateClass="MKMapView"/>
</relationships>
</class>
@@ -296,7 +322,6 @@
<class className="YelpMapViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/YelpMapViewController.h"/>
<relationships>
- <relationship kind="action" name="backToYelpMapView:" candidateClass="UIStoryboardSegue"/>
<relationship kind="outlet" name="yelpMapView" candidateClass="MKMapView"/>
</relationships>
</class>
@@ -317,7 +342,7 @@
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<inferredMetricsTieBreakers>
- <segue reference="IAP-L1-hhl"/>
- <segue reference="grn-P3-leO"/>
+ <segue reference="Th0-2G-EcE"/>
+ <segue reference="n39-9o-eUd"/>
</inferredMetricsTieBreakers>
</document>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0a23fe3

Please sign in to comment.