1. Tim Hibbard
  2. ChristianFM

Commits

Tim Hibbard  committed a7d2e09

Added help
fixed add station

  • Participants
  • Parent commits 1c1512c
  • Branches master

Comments (0)

Files changed (15)

File Christian FM.xcodeproj/project.pbxproj

View file
 /* Begin PBXBuildFile section */
 		1233EED415B4FD6600D67A41 /* ChristianRadioFinder.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = 1233EED315B4FD6600D67A41 /* ChristianRadioFinder.sqlite */; };
 		123E270515E94D82004E9925 /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 123E270415E94D82004E9925 /* WebViewController.m */; };
-		124852AA15CDB4090036C49D /* StationDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 124852A915CDB4090036C49D /* StationDetailViewController.m */; };
+		124852AA15CDB4090036C49D /* MapDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 124852A915CDB4090036C49D /* MapDetailViewController.m */; };
 		124852B115CDFCC60036C49D /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 124852B015CDFCC60036C49D /* MapKit.framework */; };
 		12514E3915B5C9C800B4A938 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 12514E3215B5C9C800B4A938 /* Icon@2x.png */; };
 		12514E3A15B5C9C800B4A938 /* Icon-Small.png in Resources */ = {isa = PBXBuildFile; fileRef = 12514E3315B5C9C800B4A938 /* Icon-Small.png */; };
 		1233EED315B4FD6600D67A41 /* ChristianRadioFinder.sqlite */ = {isa = PBXFileReference; lastKnownFileType = file; path = ChristianRadioFinder.sqlite; sourceTree = "<group>"; };
 		123E270315E94D82004E9925 /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewController.h; sourceTree = "<group>"; };
 		123E270415E94D82004E9925 /* WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewController.m; sourceTree = "<group>"; };
-		124852A815CDB4090036C49D /* StationDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StationDetailViewController.h; sourceTree = "<group>"; };
-		124852A915CDB4090036C49D /* StationDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StationDetailViewController.m; sourceTree = "<group>"; };
+		124852A815CDB4090036C49D /* MapDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapDetailViewController.h; sourceTree = "<group>"; };
+		124852A915CDB4090036C49D /* MapDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapDetailViewController.m; sourceTree = "<group>"; };
 		124852B015CDFCC60036C49D /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
 		12514E3215B5C9C800B4A938 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };
 		12514E3315B5C9C800B4A938 /* Icon-Small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small.png"; sourceTree = "<group>"; };
 			children = (
 				125DB89E15B1D07500A19A68 /* StationTableViewController.h */,
 				125DB89F15B1D07500A19A68 /* StationTableViewController.m */,
-				124852A815CDB4090036C49D /* StationDetailViewController.h */,
-				124852A915CDB4090036C49D /* StationDetailViewController.m */,
+				124852A815CDB4090036C49D /* MapDetailViewController.h */,
+				124852A915CDB4090036C49D /* MapDetailViewController.m */,
 				126CFC8815E862B9002E3B90 /* StationDetailTableViewController.h */,
 				126CFC8915E862B9002E3B90 /* StationDetailTableViewController.m */,
 				123E270315E94D82004E9925 /* WebViewController.h */,
 				12BE3CAC15B3BA5600AFCF25 /* PullTableView.m in Sources */,
 				1252493315BCEAFB0017B761 /* StationCell.m in Sources */,
 				12803D2515BD98BB0065285C /* Stations.xcdatamodeld in Sources */,
-				124852AA15CDB4090036C49D /* StationDetailViewController.m in Sources */,
+				124852AA15CDB4090036C49D /* MapDetailViewController.m in Sources */,
 				127E5BD715E135CC00B71EF7 /* StationLookupManager.m in Sources */,
 				126CFC8A15E862B9002E3B90 /* StationDetailTableViewController.m in Sources */,
 				123E270515E94D82004E9925 /* WebViewController.m in Sources */,

File Christian FM.xcodeproj/project.xcworkspace/xcuserdata/timhibbard.xcuserdatad/UserInterfaceState.xcuserstate

Binary file modified.

File Christian Radio Finder/AddNewStationViewController.h

View file
 @property (nonatomic) NSInteger locationHitCount;
 
 -(IBAction)submitButtonClicked:(id)sender;
+-(IBAction)backgroundTouched:(id)sender;
 
 @end

File Christian Radio Finder/AddNewStationViewController.m

View file
 
 @implementation AddNewStationViewController
 
+static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3;
+static const CGFloat MINIMUM_SCROLL_FRACTION = 0.2;
+static const CGFloat MAXIMUM_SCROLL_FRACTION = 0.8;
+static const CGFloat PORTRAIT_KEYBOARD_HEIGHT = 216;
+static const CGFloat LANDSCAPE_KEYBOARD_HEIGHT = 162;
+
 @synthesize locationLabel;
 @synthesize freqText;
 @synthesize callsignText;
 @synthesize locationManager;
 @synthesize locationHitCount;
 
+CGFloat animatedDistance;
+
+- (void)textFieldDidBeginEditing:(UITextField *)textField
+{
+    //from:
+    //http://cocoawithlove.com/2008/10/sliding-uitextfields-around-to-avoid.html
+    CGRect textFieldRect =
+    [self.view.window convertRect:textField.bounds fromView:textField];
+    CGRect viewRect =
+    [self.view.window convertRect:self.view.bounds fromView:self.view];
+    //So now we have the bounds, we need to calculate the fraction between the top and bottom of the middle section for the text field's midline:
+        
+        CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height;
+    CGFloat numerator =
+    midline - viewRect.origin.y
+    - MINIMUM_SCROLL_FRACTION * viewRect.size.height;
+    CGFloat denominator =
+    (MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION)
+    * viewRect.size.height;
+    CGFloat heightFraction = numerator / denominator;
+    //Clamp this fraction so that the top section is all "0.0" and the bottom section is all "1.0".
+    
+    if (heightFraction < 0.0)
+    {
+        heightFraction = 0.0;
+    }
+    else if (heightFraction > 1.0)
+    {
+        heightFraction = 1.0;
+    }
+    //Now take this fraction and convert it into an amount to scroll by multiplying by the keyboard height for the current screen orientation. Notice the calls to floor so that we only scroll by whole pixel amounts.
+        
+        UIInterfaceOrientation orientation =
+        [[UIApplication sharedApplication] statusBarOrientation];
+    if (orientation == UIInterfaceOrientationPortrait ||
+        orientation == UIInterfaceOrientationPortraitUpsideDown)
+    {
+        animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT * heightFraction);
+    }
+    else
+    {
+        animatedDistance = floor(LANDSCAPE_KEYBOARD_HEIGHT * heightFraction);
+    }
+    //Finally, apply the animation. Note the use of setAnimationBeginsFromCurrentState: — this will allow a smooth transition to new text field if the user taps on another.
+        
+        CGRect viewFrame = self.view.frame;
+    viewFrame.origin.y -= animatedDistance;
+    
+    [UIView beginAnimations:nil context:NULL];
+    [UIView setAnimationBeginsFromCurrentState:YES];
+    [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
+    
+    [self.view setFrame:viewFrame];
+    
+    [UIView commitAnimations];
+}
+
+- (void)textFieldDidEndEditing:(UITextField *)textField
+{
+    CGRect viewFrame = self.view.frame;
+    viewFrame.origin.y += animatedDistance;
+    
+    [UIView beginAnimations:nil context:NULL];
+    [UIView setAnimationBeginsFromCurrentState:YES];
+    [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
+    
+    [self.view setFrame:viewFrame];
+    
+    [UIView commitAnimations];
+}
+
+//- (BOOL)textFieldShouldReturn:(UITextField *)textField
+//{
+//    [textField resignFirstResponder];
+//    return YES;
+//}
+
+
 - (void) submitButtonClicked:(id)sender{
-    NSLog(@"hit submit");
+    if ([MFMailComposeViewController canSendMail])
+    {
+        MFMailComposeViewController *controller = [[MFMailComposeViewController alloc]
+                                                   init];
+        controller.mailComposeDelegate = (id)self;
+        NSArray *to = [[NSArray alloc] initWithObjects:@"timhibbard@gmail.com",nil];
+        [controller setToRecipients:to];
+        [controller setSubject:@"New Christian Station"];
+        
+        NSMutableString *emailBody = [[NSMutableString alloc] initWithString:@"New Station Info:\n"];
+        [emailBody appendString:[NSString stringWithFormat:@"Location: %@\n",locationLabel.text]];
+        [emailBody appendString:[NSString stringWithFormat:@"Callsign: %@\n",callsignText.text]];
+        [emailBody appendString:[NSString stringWithFormat:@"Name: %@\n",stationNameText.text]];
+        [emailBody appendString:[NSString stringWithFormat:@"Website: %@\n",websiteText.text]];
+        [emailBody appendString:[NSString stringWithFormat:@"Facebook: %@\n",facebookText.text]];
+        [emailBody appendString:[NSString stringWithFormat:@"Twitter: %@\n",twitterText.text]];
+        
+        [controller setMessageBody:emailBody isHTML:NO];
+        [self presentModalViewController:controller animated:YES];
+        
+    }
+    else
+    {
+        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"This device cannot send email" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
+        [alert show];
+    }
+}
+
+// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
+- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
+{
+    
+	// Notifies users about errors associated with the interface
+	switch (result)
+	{
+		case MFMailComposeResultCancelled:
+			break;
+		case MFMailComposeResultSaved:
+			break;
+		case MFMailComposeResultSent:
+        {
+            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Thanks!" message:@"Station submitted. I really appreciate it!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
+            [alert show];
+            //[self.navigationController popToRootViewControllerAnimated:YES];
+        }
+			break;
+		case MFMailComposeResultFailed:
+        {
+            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Email did not send" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
+            [alert show];
+        }
+			break;
+		default:
+			break;
+	}
+	[self dismissModalViewControllerAnimated:YES];
 }
 
 - (void) viewWillAppear:(BOOL)animated{
 - (void) locationManager: (CLLocationManager *) manager
      didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
     
-    NSLog(@"hit lat:%lf lng:%lf",newLocation.coordinate.latitude,newLocation.coordinate.longitude);
+    //NSLog(@"hit lat:%lf lng:%lf",newLocation.coordinate.latitude,newLocation.coordinate.longitude);
     if (locationHitCount < 1) {
         locationHitCount = locationHitCount + 1;
         return;
     
 }
 
+-(void)backgroundTouched:(id)sender{
+    [freqText resignFirstResponder];
+    [callsignText resignFirstResponder];
+    [stationNameText resignFirstResponder];
+    [websiteText resignFirstResponder];
+    [facebookText resignFirstResponder];
+    [twitterText resignFirstResponder];
+}
+
 -(BOOL)textFieldShouldReturn:(UITextField*)textField;
 {
     NSInteger nextTag = textField.tag + 1;
     } else {
         // Not found, so remove keyboard.
         [textField resignFirstResponder];
+        [self submitButtonClicked:self];
     }
     return NO; // We do not want UITextField to insert line-breaks.
 }

File Christian Radio Finder/MapDetailViewController.h

View file
+//
+//  StationDetailViewController.h
+//  Christian FM
+//
+//  Created by Tim Hibbard on 8/4/12.
+//
+//
+
+#import <UIKit/UIKit.h>
+#import <MapKit/MapKit.h>
+#import <MessageUI/MessageUI.h>
+#import <MessageUI/MFMailComposeViewController.h>
+
+@class Station;
+
+@interface MapDetailViewController : UIViewController<MKMapViewDelegate>
+{
+    
+}
+
+@property (nonatomic, strong) Station *station;
+@property (nonatomic, retain) IBOutlet UILabel *distanceLabel;
+@property (nonatomic, retain) IBOutlet MKMapView *map;
+@property (nonatomic) CLLocationManager *locationManager;
+@property (nonatomic, retain) IBOutlet UIView *displayView;
+@property (nonatomic) BOOL gotFirstHit;
+@property (nonatomic) BOOL gotInitalViewport;
+
+- (IBAction)shareButtonClicked:(id)sender;
+
+@end

File Christian Radio Finder/MapDetailViewController.m

View file
+//
+//  StationDetailViewController.m
+//  Christian FM
+//
+//  Created by Tim Hibbard on 8/4/12.
+//
+//
+
+#import "MapDetailViewController.h"
+#import "Station.h"
+#import <UIKit/UIKit.h>
+#import <MapKit/MapKit.h>
+#import <QuartzCore/QuartzCore.h>
+
+@interface MapDetailViewController ()
+
+@end
+
+@implementation MapDetailViewController
+
+@synthesize station;
+@synthesize distanceLabel;
+@synthesize map;
+@synthesize locationManager;
+@synthesize displayView;
+@synthesize gotFirstHit;
+@synthesize gotInitalViewport;
+
+-(void)shareButtonClicked:(id)sender{
+    UIActionSheet *sheet =
+    [[UIActionSheet alloc] initWithTitle:
+     NSLocalizedString(@"Share station information",
+                       @"Title for sheet displayed with options for sharing station information with other applications")
+                                delegate:(id)self
+                       cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                  destructiveButtonTitle:nil
+                       otherButtonTitles:
+     NSLocalizedString(@"Show Location in Maps", @"Show Location in Maps"),
+     nil];
+    [sheet showInView:self.view];
+    //[sheet release];
+}
+
+// Called when the user selects an option in the sheet. The sheet will automatically be dismissed.
+- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex {
+
+    switch (buttonIndex) {
+        case 0: {
+            NSString *mapsQuery =
+            [NSString stringWithFormat:@"http://maps.google.com/maps?z=6&t=h&ll=%lf,%lf",
+             station.lat.doubleValue, station.lng.doubleValue];
+            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mapsQuery]];
+        } break;
+        default:
+            break;
+    }
+
+}
+
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        // Custom initialization
+    }
+    return self;
+}
+- (void) viewWillAppear:(BOOL)animated{
+    [super viewWillAppear:animated];
+    
+    [self setTitle:station.frequency];
+
+    [distanceLabel setText:[NSString stringWithFormat:@"%@ away",station.distance]];
+    MKPointAnnotation *stationLocation = [[MKPointAnnotation alloc] init];
+    CLLocationDegrees lat = [station.lat doubleValue];
+    CLLocationDegrees lng = [station.lng doubleValue];
+    stationLocation.coordinate = CLLocationCoordinate2DMake(lat, lng);
+    [stationLocation setTitle:station.frequency];
+    [stationLocation setSubtitle:station.ownedBy];
+    [map addAnnotation:stationLocation];
+    
+    MKCircle *circle = [MKCircle circleWithCenterCoordinate:stationLocation.coordinate radius:[station.range doubleValue] * 1609];
+    [map addOverlay:circle];
+    
+
+    locationManager = [[CLLocationManager alloc]init];
+    locationManager.distanceFilter = kCLDistanceFilterNone;
+    locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
+    locationManager.delegate = (id)self;
+    [locationManager startUpdatingLocation];
+    
+}
+
+-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay{
+    MKCircleView *circleView = [[MKCircleView alloc] initWithCircle:(MKCircle *)overlay];
+    //circleView.strokeColor=[UIColor blueColor];
+    circleView.fillColor=[[UIColor blueColor] colorWithAlphaComponent:0.1];
+    return circleView;
+}
+
+- (void) locationManager: (CLLocationManager *) manager
+     didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
+    
+    if (!gotFirstHit) {
+        gotFirstHit = YES;
+        return;
+    }
+    
+    //[locationManager stopUpdatingLocation];
+    //locationManager.delegate = nil;
+    
+    NSLog(@"hit lat:%lf lng:%lf",newLocation.coordinate.latitude,newLocation.coordinate.longitude);
+    
+    CLLocationDegrees lat = [station.lat doubleValue];
+    CLLocationDegrees lng = [station.lng doubleValue];
+    CLLocation *radioLocation = [[CLLocation alloc] initWithLatitude:lat longitude:lng];
+    CLLocationDistance distance = [newLocation distanceFromLocation:radioLocation] * 0.000621371192;
+    
+    if (!gotInitalViewport) {
+        gotInitalViewport = YES;
+        CLLocationDegrees centerLat = ([station.lat doubleValue] + newLocation.coordinate.latitude) / 2;
+        CLLocationDegrees centerLng = ([station.lng doubleValue] + newLocation.coordinate.longitude) / 2;
+        
+        CLLocationCoordinate2D center = CLLocationCoordinate2DMake(centerLat, centerLng);
+        
+        //MKCoordinateSpan span = MKCoordinateSpanMake(0.4,0.4);
+        MKCoordinateSpan span = MKCoordinateSpanMake(distance / 55, distance / 55);
+        MKCoordinateRegion region = MKCoordinateRegionMake(center, span);
+        [map setRegion:region animated:YES];
+        [map regionThatFits:region];
+    }
+    
+    
+    NSString *labelText = [NSString stringWithFormat:@"%d miles away",(int) ceil(distance)];
+    if ([[distanceLabel text] isEqualToString:labelText]) {
+        return;
+    }
+    [distanceLabel setText:labelText];
+}
+
+
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    
+    displayView.layer.cornerRadius = 8;
+    displayView.layer.masksToBounds = YES;
+	// Do any additional setup after loading the view.
+}
+
+- (void)viewDidUnload
+{
+    [super viewDidUnload];
+    // Release any retained subviews of the main view.
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+    return YES;
+    return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+@end

File Christian Radio Finder/StationDetailTableViewController.m

View file
 
 #import "StationDetailTableViewController.h"
 #import "WebViewController.h"
-#import "StationDetailViewController.h"
+#import "MapDetailViewController.h"
 
 @interface StationDetailTableViewController ()
 
     }
     
     if ([[segue identifier] isEqualToString:@"ViewMapSegue"]){
-        StationDetailViewController *mapController = [segue destinationViewController];
+        MapDetailViewController *mapController = [segue destinationViewController];
         [mapController setStation:station];
         return;
     }

File Christian Radio Finder/StationDetailViewController.h

-//
-//  StationDetailViewController.h
-//  Christian FM
-//
-//  Created by Tim Hibbard on 8/4/12.
-//
-//
-
-#import <UIKit/UIKit.h>
-#import <MapKit/MapKit.h>
-#import <MessageUI/MessageUI.h>
-#import <MessageUI/MFMailComposeViewController.h>
-
-@class Station;
-
-@interface StationDetailViewController : UIViewController<MKMapViewDelegate>
-{
-    
-}
-
-@property (nonatomic, strong) Station *station;
-@property (nonatomic, retain) IBOutlet UILabel *distanceLabel;
-@property (nonatomic, retain) IBOutlet MKMapView *map;
-@property (nonatomic) CLLocationManager *locationManager;
-@property (nonatomic, retain) IBOutlet UIView *displayView;
-@property (nonatomic) BOOL gotFirstHit;
-@property (nonatomic) BOOL gotInitalViewport;
-
-- (IBAction)shareButtonClicked:(id)sender;
-
-@end

File Christian Radio Finder/StationDetailViewController.m

-//
-//  StationDetailViewController.m
-//  Christian FM
-//
-//  Created by Tim Hibbard on 8/4/12.
-//
-//
-
-#import "StationDetailViewController.h"
-#import "Station.h"
-#import <UIKit/UIKit.h>
-#import <MapKit/MapKit.h>
-#import <QuartzCore/QuartzCore.h>
-
-@interface StationDetailViewController ()
-
-@end
-
-@implementation StationDetailViewController
-
-@synthesize station;
-@synthesize distanceLabel;
-@synthesize map;
-@synthesize locationManager;
-@synthesize displayView;
-@synthesize gotFirstHit;
-@synthesize gotInitalViewport;
-
--(void)shareButtonClicked:(id)sender{
-    UIActionSheet *sheet =
-    [[UIActionSheet alloc] initWithTitle:
-     NSLocalizedString(@"Share station information",
-                       @"Title for sheet displayed with options for sharing station information with other applications")
-                                delegate:(id)self
-                       cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel")
-                  destructiveButtonTitle:nil
-                       otherButtonTitles:
-     NSLocalizedString(@"Show Location in Maps", @"Show Location in Maps"),
-     nil];
-    [sheet showInView:self.view];
-    //[sheet release];
-}
-
-// Called when the user selects an option in the sheet. The sheet will automatically be dismissed.
-- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex {
-
-    switch (buttonIndex) {
-        case 0: {
-            NSString *mapsQuery =
-            [NSString stringWithFormat:@"http://maps.google.com/maps?z=6&t=h&ll=%lf,%lf",
-             station.lat.doubleValue, station.lng.doubleValue];
-            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mapsQuery]];
-        } break;
-        default:
-            break;
-    }
-
-}
-
-
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
-{
-    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
-    if (self) {
-        // Custom initialization
-    }
-    return self;
-}
-- (void) viewWillAppear:(BOOL)animated{
-    [super viewWillAppear:animated];
-    
-    [self setTitle:station.frequency];
-
-    [distanceLabel setText:[NSString stringWithFormat:@"%@ away",station.distance]];
-    MKPointAnnotation *stationLocation = [[MKPointAnnotation alloc] init];
-    CLLocationDegrees lat = [station.lat doubleValue];
-    CLLocationDegrees lng = [station.lng doubleValue];
-    stationLocation.coordinate = CLLocationCoordinate2DMake(lat, lng);
-    [stationLocation setTitle:station.frequency];
-    [stationLocation setSubtitle:station.ownedBy];
-    [map addAnnotation:stationLocation];
-    
-    MKCircle *circle = [MKCircle circleWithCenterCoordinate:stationLocation.coordinate radius:[station.range doubleValue] * 1609];
-    [map addOverlay:circle];
-    
-
-    locationManager = [[CLLocationManager alloc]init];
-    locationManager.distanceFilter = kCLDistanceFilterNone;
-    locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
-    locationManager.delegate = (id)self;
-    [locationManager startUpdatingLocation];
-    
-}
-
--(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay{
-    MKCircleView *circleView = [[MKCircleView alloc] initWithCircle:(MKCircle *)overlay];
-    //circleView.strokeColor=[UIColor blueColor];
-    circleView.fillColor=[[UIColor blueColor] colorWithAlphaComponent:0.1];
-    return circleView;
-}
-
-- (void) locationManager: (CLLocationManager *) manager
-     didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
-    
-    if (!gotFirstHit) {
-        gotFirstHit = YES;
-        return;
-    }
-    
-    //[locationManager stopUpdatingLocation];
-    //locationManager.delegate = nil;
-    
-    NSLog(@"hit lat:%lf lng:%lf",newLocation.coordinate.latitude,newLocation.coordinate.longitude);
-    
-    CLLocationDegrees lat = [station.lat doubleValue];
-    CLLocationDegrees lng = [station.lng doubleValue];
-    CLLocation *radioLocation = [[CLLocation alloc] initWithLatitude:lat longitude:lng];
-    CLLocationDistance distance = [newLocation distanceFromLocation:radioLocation] * 0.000621371192;
-    
-    if (!gotInitalViewport) {
-        gotInitalViewport = YES;
-        CLLocationDegrees centerLat = ([station.lat doubleValue] + newLocation.coordinate.latitude) / 2;
-        CLLocationDegrees centerLng = ([station.lng doubleValue] + newLocation.coordinate.longitude) / 2;
-        
-        CLLocationCoordinate2D center = CLLocationCoordinate2DMake(centerLat, centerLng);
-        
-        //MKCoordinateSpan span = MKCoordinateSpanMake(0.4,0.4);
-        MKCoordinateSpan span = MKCoordinateSpanMake(distance / 55, distance / 55);
-        MKCoordinateRegion region = MKCoordinateRegionMake(center, span);
-        [map setRegion:region animated:YES];
-        [map regionThatFits:region];
-    }
-    
-    
-    NSString *labelText = [NSString stringWithFormat:@"%d miles away",(int) ceil(distance)];
-    if ([[distanceLabel text] isEqualToString:labelText]) {
-        return;
-    }
-    [distanceLabel setText:labelText];
-}
-
-
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-    
-    displayView.layer.cornerRadius = 8;
-    displayView.layer.masksToBounds = YES;
-	// Do any additional setup after loading the view.
-}
-
-- (void)viewDidUnload
-{
-    [super viewDidUnload];
-    // Release any retained subviews of the main view.
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
-    return YES;
-    return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-
-@end

File Christian Radio Finder/StationMapViewController.h

View file
 #import "Station.h"
 #import "StationLookupManager.h"
 #import "StationDetailTableViewController.h"
+#import <CoreLocation/CoreLocation.h>
 
-@interface StationMapViewController : UIViewController<MKMapViewDelegate, UIGestureRecognizerDelegate>
+@interface StationMapViewController : UIViewController<MKMapViewDelegate, UIGestureRecognizerDelegate, UISearchBarDelegate>
 
 @property (nonatomic, retain) IBOutlet MKMapView *map;
 @property (nonatomic) CLLocationManager *locationManager;
 
 - (IBAction)longPress:(UILongPressGestureRecognizer *)gestureRecognizer;
 - (IBAction)infoButtonPress:(UIButton * )sender;
+- (IBAction)searchBarSearchButtonClicked:(UISearchBar *)searchBar;
+- (IBAction)searchBarCancelButtonClicked:(UISearchBar *)searchBar;
+- (IBAction)shareButtonClicked:(id)sender;
 
 - (void) addOverlayFromStationArray;
 

File Christian Radio Finder/StationMapViewController.m

View file
 @synthesize searchLocation;
 @synthesize infoLabel;
 
+-(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar{
+    [searchBar resignFirstResponder];
+}
+
+- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
+    [searchBar resignFirstResponder];
+    CLGeocoder *geocoder = [[CLGeocoder alloc] init];
+    [geocoder geocodeAddressString:searchBar.text completionHandler:^(NSArray *placemarks, NSError *error) {
+        //Error checking
+        
+        CLPlacemark *placemark = [placemarks objectAtIndex:0];
+        [self searchAtLocation:placemark.region.center.latitude :placemark.region.center.longitude];
+        
+//        MKCoordinateRegion region;
+//        region.center.latitude = placemark.region.center.latitude;
+//        region.center.longitude = placemark.region.center.longitude;
+//        MKCoordinateSpan span;
+//        double radius = placemark.region.radius / 1000; // convert to km
+//        
+//        NSLog(@"Radius is %f", radius);
+//        span.latitudeDelta = radius / 112.0;
+//        
+//        region.span = span;
+//        
+//        [map setRegion:region animated:YES];
+    }];
+}
+
 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
 {
     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
     return self;
 }
 
+- (void) searchAtLocation: (double) lat : (double) lng{
+    CLLocationCoordinate2D searchPoint = CLLocationCoordinate2DMake(lat, lng);
+    
+    [self setSearchLocation:searchPoint];
+    
+    [map setShowsUserLocation:NO];
+    
+    //Remove all added annotations
+    [map removeAnnotations:map.annotations];
+    
+    [map removeOverlays:map.overlays];
+    
+    
+    MKPointAnnotation *pressPin = [[MKPointAnnotation alloc] init];
+    [pressPin setCoordinate:searchPoint];
+    
+    [pressPin setTitle:@"Dropped Pin"];
+    
+    [map addAnnotation:pressPin];
+    
+    StationLookupManager *stationLookupManager = [[StationLookupManager alloc] init];
+    
+    [stationLookupManager getData:searchPoint.latitude :searchPoint.longitude :0 :^(NSString *errorMessage) {
+        NSLog(@"%@",errorMessage);
+        UIAlertView *errorView = [[UIAlertView alloc] initWithTitle:@"Error" message:errorMessage delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
+        [errorView show];
+    } :^(NSMutableArray *xmlStationArray) {
+        NSMutableArray *bindableArray = [[NSMutableArray alloc]init];
+        for (int a = 0; a < [xmlStationArray count]; a++) {
+            Station *newStation = (Station *)[xmlStationArray objectAtIndex:a];
+            CLLocationDegrees lat = [newStation.lat doubleValue];
+            CLLocationDegrees lng = [newStation.lng doubleValue];
+            CLLocation *radioLocation = [[CLLocation alloc] initWithLatitude:lat longitude:lng];
+            CLLocationDistance distance = [[[CLLocation alloc] initWithLatitude:searchPoint.latitude longitude:searchPoint.longitude ] distanceFromLocation:radioLocation] * 0.000621371192;
+            [newStation setDistance:[NSString stringWithFormat:@"%d miles", (int) ceil(distance)]];
+            if (distance <= [newStation.range doubleValue]) {
+                //[xmlStationArray replaceObjectAtIndex:a withObject:newStation];
+                [bindableArray addObject:newStation];
+            }
+            
+        }
+        
+        
+        [self setStationArray:bindableArray];
+        [self addOverlayFromStationArray];
+    }];
+}
+
 - (IBAction)longPress:(UILongPressGestureRecognizer *)gestureRecognizer{
     if (gestureRecognizer.state != UIGestureRecognizerStateBegan){
         return;
     isSearching = YES;
     
     CGPoint touchPoint = [gestureRecognizer locationInView:map];
+    
     CLLocationCoordinate2D touchLatLng = [map convertPoint:touchPoint toCoordinateFromView:map];
-    [self setSearchLocation:touchLatLng];
+    //[self setSearchLocation:touchLatLng];
     
     NSLog(@"got long press at %lf, %lf",touchLatLng.latitude,touchLatLng.longitude);
     
+    [self searchAtLocation:touchLatLng.latitude :touchLatLng.longitude];
+    return;
+    
     [map setShowsUserLocation:NO];
     
     //Remove all added annotations
 - (void)viewDidLoad
 {
     [super viewDidLoad];
-    
+
 	// Do any additional setup after loading the view.
 }
 
     return YES;
 }
 
+- (void) shareButtonClicked:(id)sender{
+    UIActionSheet *sheet =
+    [[UIActionSheet alloc] initWithTitle:
+     NSLocalizedString(@"Share stations",
+                       @"Title for sheet displayed with options for displaying station information in other applications")
+                                delegate:(id)self
+                       cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel")
+                  destructiveButtonTitle:nil
+                       otherButtonTitles:NSLocalizedString(@"Email", @"Email"),NSLocalizedString(@"SMS", @"SMS"),
+     nil];
+    [sheet showInView:self.view];
+    
+}
+
+// Called when the user selects an option in the sheet. The sheet will automatically be dismissed.
+- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex {
+    
+    switch (buttonIndex) {
+        case 0: {
+            if ([MFMailComposeViewController canSendMail])
+            {
+                MFMailComposeViewController *controller = [[MFMailComposeViewController alloc]
+                                                           init];
+                controller.mailComposeDelegate = (id)self;
+                [controller setSubject:@"Radio Station Information"];
+                
+                NSMutableString *emailBody = [[NSMutableString alloc] initWithString:@"Station List:\n"];
+                
+                for (Station *station in stationArray) {
+                    [emailBody appendString:[NSString stringWithFormat:@"%@ located in %@\n%@ away\n",station.frequency,station.city,station.distance]];
+                }
+                
+                
+                [controller setMessageBody:emailBody isHTML:NO];
+                [self presentModalViewController:controller animated:YES];
+                
+            }
+        } break;
+        case 1: {
+            if ([MFMessageComposeViewController canSendText])
+            {
+                MFMessageComposeViewController *smsController = [[MFMessageComposeViewController alloc]
+                                                                 init];
+                smsController.messageComposeDelegate = (id)self;
+                NSMutableString *smsBody = [[NSMutableString alloc] initWithString:@"Stations - "];
+                for (Station *station in stationArray) {
+                    [smsBody appendFormat:@"%@ in %@",station.frequency,station.city];
+                }
+                
+                [smsController setBody:smsBody];
+                [self presentModalViewController:smsController animated:YES];
+                
+            }
+        } break;
+        default:
+            break;
+    }
+    
+}
+
+// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
+- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
+{
+    
+	// Notifies users about errors associated with the interface
+	switch (result)
+	{
+		case MFMailComposeResultCancelled:
+			break;
+		case MFMailComposeResultSaved:
+			break;
+		case MFMailComposeResultSent:
+			break;
+		case MFMailComposeResultFailed:
+			break;
+		default:
+			break;
+	}
+	[self dismissModalViewControllerAnimated:YES];
+}
+
+- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{
+    [self dismissModalViewControllerAnimated:YES];
+}
+
 @end

File Christian Radio Finder/StationTableViewController.h

View file
 typedef enum {
     Owner,
     City,
+    Strength,
     Distance,
-    Range,
-    Strength
+    Range
 } displayDetail;
 
 @property (nonatomic,retain) UILabel *loadMore;
 @property (nonatomic) NSInteger rangeDelta;
 @property (nonatomic) BOOL selectionHasBeenMade;
 @property (nonatomic) displayDetail displayInDetails;
+@property (nonatomic) NSString *helpText;
 
 
 
 
-- (void) fetchRecords;
 - (void) fetchByLocation;
 - (IBAction)shareButtonClicked:(id)sender;
 - (IBAction)longPress:(UILongPressGestureRecognizer *)gestureRecognizer;

File Christian Radio Finder/StationTableViewController.m

View file
 #import <CoreLocation/CoreLocation.h>
 #import "PullTableView.h"
 #import "StationCell.h"
-#import "StationDetailViewController.h"
+#import "MapDetailViewController.h"
 #import "StationLookupManager.h"
 #import "StationDetailTableViewController.h"
 #import "StationMapViewController.h"
 @synthesize rangeDelta;
 @synthesize displayInDetails;
 @synthesize loadMore;
+@synthesize helpText;
 
 #define kCellHeight 44.0
 
                                 delegate:(id)self
                        cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel")
                   destructiveButtonTitle:nil
-                       otherButtonTitles:NSLocalizedString(@"Email", @"Email"),NSLocalizedString(@"SMS", @"SMS"),NSLocalizedString(@"View Map", @"View Map"),
+                       otherButtonTitles:NSLocalizedString(@"Email", @"Email"),NSLocalizedString(@"SMS", @"SMS"),NSLocalizedString(@"Add Station", @"Add Station"),
      nil];
     [sheet showInView:self.view];
     
             }
         } break;
         case 2:{
-            [self performSegueWithIdentifier:@"ViewAllOnMapSegue" sender:self];
+            [self performSegueWithIdentifier:@"NewStationSegue" sender:self];
         }break;
 
         default:
     }
     
     if ([[segue identifier] isEqualToString:@"ShowMapFromLongPressSegue"]) {
-        StationDetailViewController *mapController = [segue destinationViewController];
+        MapDetailViewController *mapController = [segue destinationViewController];
         mapController.station = [stationArray objectAtIndex:selectedRowIndex];
         return;
     }
 }
 
 - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-    return [stationArray count] + 1;
+    int additional = 1;
+    if ([helpText isEqualToString:@"-"] == NO) {
+        additional = additional + 1;
+    }
+    return [stationArray count] + additional;
 }
 
 - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
         [cell.cityLabel setText:@""];
         return cell;
     }
+    
+    if (indexPath.row == stationArray.count + 1) {
+        [cell.textLabel setFont:[UIFont italicSystemFontOfSize:17]];
+        [cell.textLabel setText:helpText];
+        [cell setAccessoryType:UITableViewCellAccessoryNone];
+        [cell.textLabel setTextAlignment:UITextAlignmentCenter];
+        [cell.frequencyLabel setText:@""];
+        [cell.cityLabel setText:@""];
+        return cell;
+    }
 
     Station *station = [stationArray objectAtIndex:[indexPath row]];
     
     }
     [self setSelectedRowIndex:indexPath.row];
     //NSLog(@"long press at index:%i",indexPath.row);
+    if ([helpText isEqualToString:@"Press and hold station to view map"]) {
+        [self setHelpText:@"-"];
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        [defaults setObject:helpText forKey:@"helpText"];
+        [defaults synchronize];
+        [self performSelectorOnMainThread:@selector(refreshTableView) withObject:nil waitUntilDone:NO];
+    }
     [self performSegueWithIdentifier:@"ShowMapFromLongPressSegue" sender:self];
     
     
     }
     
     displayInDetails = displayInDetails - 1;
+    if ([helpText isEqualToString:@"Swipe right to cycle backwards"]) {
+        [self setHelpText:@"Press and hold station to view map"];
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        [defaults setObject:helpText forKey:@"helpText"];
+        [defaults synchronize];
+    }
+    
     [self performSelectorOnMainThread:@selector(refreshTableView) withObject:nil waitUntilDone:NO];
     
 }
     
     displayInDetails = displayInDetails + 1;
     
+    if ([helpText isEqualToString:@"Swipe left again to see more"]) {
+        [self setHelpText:@"Swipe right to cycle backwards"];
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        [defaults setObject:helpText forKey:@"helpText"];
+        [defaults synchronize];
+    }
+    if ([helpText isEqualToString:@"Swipe left to see more info"]) {
+        [self setHelpText:@"Swipe left again to see more"];
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        [defaults setObject:helpText forKey:@"helpText"];
+        [defaults synchronize];
+    }
     [self performSelectorOnMainThread:@selector(refreshTableView) withObject:nil waitUntilDone:NO];
 }
 
 
-- (void) fetchRecords {
-    NSEntityDescription *station = [NSEntityDescription entityForName:@"Station" inManagedObjectContext:managedObjectContext];
-    
-    NSFetchRequest *request = [[NSFetchRequest alloc] init];
-    [request setEntity:station];
-    
-    NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"frequency" ascending:YES];
-    NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
-    [request setSortDescriptors:sortDescriptors];
-
-    
-    NSError *error;
-    NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
-    
-    if (!mutableFetchResults) {
-        //blow up
-    }
-    
-    [self setStationArray:mutableFetchResults];
-}
+//- (void) fetchRecords {
+//    NSEntityDescription *station = [NSEntityDescription entityForName:@"Station" inManagedObjectContext:managedObjectContext];
+//    
+//    NSFetchRequest *request = [[NSFetchRequest alloc] init];
+//    [request setEntity:station];
+//    
+//    NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"frequency" ascending:YES];
+//    NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
+//    [request setSortDescriptors:sortDescriptors];
+//
+//    
+//    NSError *error;
+//    NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
+//    
+//    if (!mutableFetchResults) {
+//        //blow up
+//    }
+//    
+//    [self setStationArray:mutableFetchResults];
+//}
 
 - (void) fetchByLocation{
     [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
      didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
 
     
-    double GPSlat, GPSlng, delta;
+    double GPSlat, GPSlng;
     GPSlat = locationManager.location.coordinate.latitude;
     GPSlng = locationManager.location.coordinate.longitude;
     if (GPSlat == 0) {
         didFailWithError:(NSError *)error {
     [locationManager stopUpdatingLocation];
     locationManager.delegate = nil;
-    [self fetchRecords];
+    //throw up a message
 }
 
 
     [self.pullTableView addGestureRecognizer:rightSwipeGesture];
     [self.pullTableView addGestureRecognizer:leftSwipeGesture];
     
-    //[self fetchByLocation];
-    //[self fetchRecords];
-   
+    [self setHelpText:@"Swipe left to see more info"];
+    
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    [self setHelpText:[defaults objectForKey:@"helpText"]];
+    if (helpText.length == 0) {
+        [self setHelpText:@"Swipe left to see more info"];
+    }
+    
+    [defaults setObject:helpText forKey:@"helpText"];
+    [defaults synchronize];
     
-
-    // Uncomment the following line to preserve selection between presentations.
-    // self.clearsSelectionOnViewWillAppear = NO;
- 
-    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
-    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
 }
 
 -(void)didChangeSegmentControl:(UISegmentedControl*)control{
             [self performSelector:@selector(loadMoreDataToTable) withObject:nil afterDelay:0.1f];
         }
     }
+    else if (indexPath.row == stationArray.count + 1){
+        //do nada
+    }
     else{
         [self performSegueWithIdentifier:@"StationDetailSegue" sender:tableView];
     }

File Christian Radio Finder/en.lproj/MainStoryboard_iPad.storyboard

View file
             </objects>
             <point key="canvasLocation" x="-1113" y="-685"/>
         </scene>
-        <!--Station Detail View Controller - Detail-->
+        <!--Map Detail View Controller - Detail-->
         <scene sceneID="kie-xs-YV5">
             <objects>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="YRv-ry-QSh" userLabel="First Responder" sceneMemberID="firstResponder"/>
-                <viewController id="rKy-Fh-73S" customClass="StationDetailViewController" sceneMemberID="viewController">
+                <viewController id="rKy-Fh-73S" customClass="MapDetailViewController" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="Vfa-98-fea">
                         <rect key="frame" x="0.0" y="64" width="768" height="960"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                 <relationship kind="outlet" name="twitterCell" candidateClass="UITableViewCell"/>
             </relationships>
         </class>
-        <class className="StationDetailViewController" superclassName="UIViewController">
-            <source key="sourceIdentifier" type="project" relativePath="./Classes/StationDetailViewController.h"/>
-            <relationships>
-                <relationship kind="action" name="shareButtonClicked:"/>
-                <relationship kind="outlet" name="displayView" candidateClass="UIView"/>
-                <relationship kind="outlet" name="distanceLabel" candidateClass="UILabel"/>
-                <relationship kind="outlet" name="map" candidateClass="MKMapView"/>
-            </relationships>
-        </class>
         <class className="StationMapViewController" superclassName="UIViewController">
             <source key="sourceIdentifier" type="project" relativePath="./Classes/StationMapViewController.h"/>
             <relationships>

File Christian Radio Finder/en.lproj/MainStoryboard_iPhone.storyboard

View file
                         <rect key="frame" x="0.0" y="64" width="320" height="416"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                        <searchBar key="tableHeaderView" contentMode="redraw" placeholder="placeholder" showsSearchResultsButton="YES" showsBookmarkButton="YES" showsCancelButton="YES" id="pXM-KK-QSe">
-                            <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
-                            <textInputTraits key="textInputTraits"/>
-                            <scopeButtonTitles>
-                                <string>Title</string>
-                                <string>Title</string>
-                            </scopeButtonTitles>
-                        </searchBar>
                         <prototypes>
                             <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationWidth="0.0" reuseIdentifier="StationCell" rowHeight="45" id="zLs-it-ztM" customClass="StationCell">
-                                <rect key="frame" x="0.0" y="66" width="320" height="45"/>
+                                <rect key="frame" x="0.0" y="22" width="320" height="45"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
                                     <rect key="frame" x="0.0" y="0.0" width="300" height="44"/>
                     </tableView>
                     <toolbarItems/>
                     <navigationItem key="navigationItem" title="Christian Radio" id="901-rG-B9A">
-                        <barButtonItem key="leftBarButtonItem" systemItem="add" id="pmL-xW-3HZ">
+                        <barButtonItem key="leftBarButtonItem" title="Map" id="pmL-xW-3HZ">
                             <connections>
-                                <segue destination="stL-0M-1Wr" kind="push" id="3cc-bM-D6n"/>
+                                <segue destination="VvI-Zu-7m3" kind="push" identifier="ViewAllOnMapSegue" id="cJA-Vi-wxL"/>
                             </connections>
                         </barButtonItem>
                         <barButtonItem key="rightBarButtonItem" systemItem="action" id="Qe2-Eo-4c6">
                     <connections>
                         <outlet property="pullTableView" destination="fEv-f8-grr" id="K96-Ll-bqi"/>
                         <segue destination="eX2-ZJ-yyp" kind="push" identifier="ShowMapFromLongPressSegue" id="UIs-tl-QCd"/>
-                        <segue destination="VvI-Zu-7m3" kind="push" identifier="ViewAllOnMapSegue" id="xr0-FB-zgJ"/>
                         <segue destination="kca-X7-Fp3" kind="push" identifier="StationDetailSegue" id="Opu-Xs-6iV"/>
+                        <segue destination="stL-0M-1Wr" kind="push" identifier="NewStationSegue" id="YTC-0O-Lrf"/>
                     </connections>
                 </tableViewController>
                 <pongPressGestureRecognizer allowableMovement="10" minimumPressDuration="0.5" id="YNQ-lP-Qtt">
             </objects>
             <point key="canvasLocation" x="-1113" y="-685"/>
         </scene>
-        <!--Station Detail View Controller - Detail-->
+        <!--Map Detail View Controller - Detail-->
         <scene sceneID="U0d-4Q-Io6">
             <objects>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="tLh-6T-P6u" userLabel="First Responder" sceneMemberID="firstResponder"/>
-                <viewController id="eX2-ZJ-yyp" customClass="StationDetailViewController" sceneMemberID="viewController">
+                <viewController id="eX2-ZJ-yyp" customClass="MapDetailViewController" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="4oh-Ld-O5e">
                         <rect key="frame" x="0.0" y="64" width="320" height="416"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                     </connections>
                 </tableViewController>
             </objects>
-            <point key="canvasLocation" x="-784" y="-310"/>
+            <point key="canvasLocation" x="-648" y="462"/>
         </scene>
         <!--Navigation Controller - Item-->
         <scene sceneID="U2j-j4-VBq">
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                             <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="ThW-nh-IZ8">
-                                <rect key="frame" x="0.0" y="-6" width="320" height="422"/>
+                                <rect key="frame" x="0.0" y="0.0" width="320" height="422"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
                                     <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Location:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="0XV-sb-iDl">
                                         <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
                                         <nil key="highlightedColor"/>
                                     </label>
-                                    <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" id="cRV-xs-22L">
+                                    <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="e.g. 99.6" minimumFontSize="17" id="cRV-xs-22L">
                                         <rect key="frame" x="141" y="49" width="159" height="31"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                                        <textInputTraits key="textInputTraits" autocapitalizationType="allCharacters"/>
+                                        <textInputTraits key="textInputTraits" autocapitalizationType="allCharacters" keyboardType="numbersAndPunctuation" returnKeyType="next"/>
+                                        <connections>
+                                            <outlet property="delegate" destination="stL-0M-1Wr" id="sPL-rb-ChX"/>
+                                        </connections>
                                     </textField>
-                                    <textField opaque="NO" clipsSubviews="YES" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" id="l10-sB-Aa9">
+                                    <textField opaque="NO" clipsSubviews="YES" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="e.g. WPUF" minimumFontSize="17" id="l10-sB-Aa9">
                                         <rect key="frame" x="141" y="88" width="159" height="31"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                                        <textInputTraits key="textInputTraits" autocapitalizationType="allCharacters" autocorrectionType="no"/>
+                                        <textInputTraits key="textInputTraits" autocapitalizationType="allCharacters" autocorrectionType="no" returnKeyType="next"/>
+                                        <connections>
+                                            <outlet property="delegate" destination="stL-0M-1Wr" id="eTX-xG-eqc"/>
+                                        </connections>
                                     </textField>
-                                    <textField opaque="NO" clipsSubviews="YES" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" id="Gg1-U7-H8f">
+                                    <textField opaque="NO" clipsSubviews="YES" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="e.g. K-LOVE" minimumFontSize="17" id="Gg1-U7-H8f">
                                         <rect key="frame" x="141" y="127" width="159" height="31"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                                        <textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no"/>
+                                        <textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" returnKeyType="next"/>
+                                        <connections>
+                                            <outlet property="delegate" destination="stL-0M-1Wr" id="ZFg-2v-hQX"/>
+                                        </connections>
                                     </textField>
                                     <textField opaque="NO" clipsSubviews="YES" tag="3" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" id="B1a-99-xnp">
                                         <rect key="frame" x="141" y="166" width="159" height="31"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                                        <textInputTraits key="textInputTraits" keyboardType="URL"/>
+                                        <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="URL" returnKeyType="next"/>
+                                        <connections>
+                                            <outlet property="delegate" destination="stL-0M-1Wr" id="4qg-Ov-5Ve"/>
+                                        </connections>
                                     </textField>
                                     <textField opaque="NO" clipsSubviews="YES" tag="4" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" id="qYv-49-nnc">
                                         <rect key="frame" x="141" y="205" width="159" height="31"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                                        <textInputTraits key="textInputTraits" keyboardType="URL"/>
+                                        <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="URL" returnKeyType="next"/>
+                                        <connections>
+                                            <outlet property="delegate" destination="stL-0M-1Wr" id="0G5-Mc-KaP"/>
+                                        </connections>
                                     </textField>
                                     <textField opaque="NO" clipsSubviews="YES" tag="5" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" id="GtZ-Aw-1fT">
                                         <rect key="frame" x="141" y="244" width="159" height="31"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                                        <textInputTraits key="textInputTraits"/>
+                                        <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress" returnKeyType="done"/>
+                                        <connections>
+                                            <outlet property="delegate" destination="stL-0M-1Wr" id="1EG-Xz-I21"/>
+                                        </connections>
                                     </textField>
-                                    <button opaque="NO" tag="6" contentMode="scaleToFill" highlighted="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="Mtk-1p-AZF">
-                                        <rect key="frame" x="20" y="365" width="280" height="37"/>
+                                    <button opaque="NO" contentMode="scaleToFill" highlighted="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="Mtk-1p-AZF">
+                                        <rect key="frame" x="20" y="283" width="280" height="37"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
                                         <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
                                         <state key="normal" title="Submit">
                     </connections>
                 </viewController>
             </objects>
-            <point key="canvasLocation" x="-584" y="-1552"/>
+            <point key="canvasLocation" x="-364" y="-1516"/>
         </scene>
         <!--Station Map View Controller - Stations Map-->
         <scene sceneID="n9r-gB-eiV">
                 <placeholder placeholderIdentifier="IBFirstResponder" id="6rS-st-orZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <viewController id="VvI-Zu-7m3" customClass="StationMapViewController" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="Tn8-q8-Hts">
-                        <rect key="frame" x="0.0" y="64" width="320" height="416"/>
+                        <rect key="frame" x="0.0" y="64" width="320" height="372"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                             <mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" showsUserLocation="YES" id="Mns-XZ-FER">
-                                <rect key="frame" x="0.0" y="0.0" width="320" height="416"/>
+                                <rect key="frame" x="0.0" y="44" width="320" height="328"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <gestureRecognizers/>
                                 <connections>
                                 </connections>
                             </mapView>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="infoDark" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" id="9oU-ED-HcA">
-                                <rect key="frame" x="293" y="388" width="18" height="19"/>
+                                <rect key="frame" x="293" y="344" width="18" height="19"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
                                 <fontDescription key="fontDescription" type="boldSystem" size="button"/>
                                 <state key="normal">
                                     <action selector="infoButtonPress:" destination="VvI-Zu-7m3" eventType="touchUpInside" id="6VP-Hr-f5P"/>
                                 </connections>
                             </button>
+                            <searchBar contentMode="redraw" placeholder="enter city to find" showsCancelButton="YES" id="Fbq-hZ-85d">
+                                <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                                <textInputTraits key="textInputTraits" autocorrectionType="no"/>
+                                <connections>
+                                    <outlet property="delegate" destination="VvI-Zu-7m3" id="A9c-dk-i3W"/>
+                                </connections>
+                            </searchBar>
                             <label hidden="YES" opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Press and hold to search" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="onJ-Bl-Sat">
-                                <rect key="frame" x="52" y="386" width="237" height="21"/>
+                                <rect key="frame" x="53" y="343" width="237" height="21"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
                                 <color key="backgroundColor" red="0.64705882349999999" green="0.74901960779999999" blue="0.86666666670000003" alpha="1" colorSpace="calibratedRGB"/>
                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="21"/>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                     </view>
-                    <navigationItem key="navigationItem" title="Stations Map" id="CXD-wO-MQb"/>
+                    <toolbarItems>
+                        <barButtonItem title="Item" id="SYH-vq-srQ"/>
+                    </toolbarItems>
+                    <navigationItem key="navigationItem" title="Stations Map" id="CXD-wO-MQb">
+                        <barButtonItem key="rightBarButtonItem" systemItem="action" id="e4W-X2-y9z">
+                            <connections>
+                                <action selector="shareButtonClicked:" destination="VvI-Zu-7m3" id="WMu-ZS-gN3"/>
+                            </connections>
+                        </barButtonItem>
+                    </navigationItem>
+                    <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
                     <connections>
-                        <outlet property="infoLabel" destination="onJ-Bl-Sat" id="Jhn-vK-qIS"/>
                         <outlet property="map" destination="Mns-XZ-FER" id="Ccd-ts-vH3"/>
                         <segue destination="kca-X7-Fp3" kind="push" identifier="ShowDetailsFromMapSegue" id="DRz-EE-aMg"/>
                     </connections>
                     </connections>
                 </pongPressGestureRecognizer>
             </objects>
-            <point key="canvasLocation" x="65" y="-104"/>
+            <point key="canvasLocation" x="-1143" y="34"/>
         </scene>
     </scenes>
     <resources>
         <class className="AddNewStationViewController" superclassName="UIViewController">
             <source key="sourceIdentifier" type="project" relativePath="./Classes/AddNewStationViewController.h"/>
             <relationships>
+                <relationship kind="action" name="backgroundTouched:"/>
                 <relationship kind="action" name="submitButtonClicked:"/>
                 <relationship kind="outlet" name="callsignText" candidateClass="UITextField"/>
                 <relationship kind="outlet" name="facebookText" candidateClass="UITextField"/>
         <class className="CLLocationManager" superclassName="NSObject">
             <source key="sourceIdentifier" type="project" relativePath="./Classes/CLLocationManager.h"/>
         </class>
+        <class className="MapDetailViewController" superclassName="UIViewController">
+            <source key="sourceIdentifier" type="project" relativePath="./Classes/MapDetailViewController.h"/>
+            <relationships>
+                <relationship kind="action" name="shareButtonClicked:"/>
+                <relationship kind="outlet" name="displayView" candidateClass="UIView"/>
+                <relationship kind="outlet" name="distanceLabel" candidateClass="UILabel"/>
+                <relationship kind="outlet" name="map" candidateClass="MKMapView"/>
+            </relationships>
+        </class>
         <class className="PullTableView" superclassName="UITableView">
             <source key="sourceIdentifier" type="project" relativePath="./Classes/PullTableView.h"/>
             <relationships>
                 <relationship kind="outlet" name="twitterCell" candidateClass="UITableViewCell"/>
             </relationships>
         </class>
-        <class className="StationDetailViewController" superclassName="UIViewController">
-            <source key="sourceIdentifier" type="project" relativePath="./Classes/StationDetailViewController.h"/>
-            <relationships>
-                <relationship kind="action" name="shareButtonClicked:"/>
-                <relationship kind="outlet" name="displayView" candidateClass="UIView"/>
-                <relationship kind="outlet" name="distanceLabel" candidateClass="UILabel"/>
-                <relationship kind="outlet" name="map" candidateClass="MKMapView"/>
-            </relationships>
-        </class>
         <class className="StationMapViewController" superclassName="UIViewController">
             <source key="sourceIdentifier" type="project" relativePath="./Classes/StationMapViewController.h"/>
             <relationships>
                 <relationship kind="action" name="infoButtonPress:" candidateClass="UIButton"/>
                 <relationship kind="action" name="longPress:" candidateClass="UILongPressGestureRecognizer"/>
+                <relationship kind="action" name="searchBarCancelButtonClicked:" candidateClass="UISearchBar"/>
+                <relationship kind="action" name="searchBarSearchButtonClicked:" candidateClass="UISearchBar"/>
+                <relationship kind="action" name="shareButtonClicked:"/>
                 <relationship kind="outlet" name="infoLabel" candidateClass="UILabel"/>
                 <relationship kind="outlet" name="map" candidateClass="MKMapView"/>
             </relationships>
         <simulatedScreenMetrics key="destination"/>
     </simulatedMetricsContainer>
     <inferredMetricsTieBreakers>
+        <segue reference="Opu-Xs-6iV"/>
         <segue reference="UIs-tl-QCd"/>
-        <segue reference="DRz-EE-aMg"/>
         <segue reference="fZh-Gy-HOC"/>
     </inferredMetricsTieBreakers>
 </document>