Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #57 from Esri/gagan_FindTaskSample_storyboard
Browse files Browse the repository at this point in the history
Ported FindTaskSample to Storyboard
  • Loading branch information
dg0yal committed Apr 16, 2014
2 parents 7ef831a + fceb209 commit ddcc4b3
Show file tree
Hide file tree
Showing 14 changed files with 212 additions and 1,129 deletions.
13 changes: 1 addition & 12 deletions FindTaskSample/Classes/FindTaskSampleViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@
#import <ArcGIS/ArcGIS.h>


@interface FindTaskSampleViewController : UIViewController <AGSFindTaskDelegate,UISearchBarDelegate,AGSMapViewLayerDelegate, AGSCalloutDelegate, AGSLayerCalloutDelegate> {

AGSMapView *_mapView;
AGSDynamicMapServiceLayer *_dynamicLayer;
UISearchBar *_searchBar;
AGSGraphicsLayer *_graphicsLayer;
AGSFindTask *_findTask;
AGSFindParameters *_findParams;
AGSCalloutTemplate *_cityCalloutTemplate;
AGSCalloutTemplate *_riverCalloutTemplate;
AGSCalloutTemplate *_stateCalloutTemplate;
}
@interface FindTaskSampleViewController : UIViewController <AGSFindTaskDelegate,UISearchBarDelegate,AGSMapViewLayerDelegate, AGSCalloutDelegate, AGSLayerCalloutDelegate>

@property (nonatomic, strong) IBOutlet AGSMapView *mapView;
@property (nonatomic, strong) IBOutlet UISearchBar *searchBar;
Expand Down
28 changes: 18 additions & 10 deletions FindTaskSample/Classes/FindTaskSampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
#define kSearchBarPlaceholder @"Find State/City/River"
#define kDynamicMapServiceURL @"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer"
#define kTiledMapServiceURL @"http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"
#define kResultsSegueIdentifier @"ResultsSegue"

@interface FindTaskSampleViewController ()

@property (nonatomic, strong) AGSGraphic *selectedGraphic;

@end

@implementation FindTaskSampleViewController

Expand Down Expand Up @@ -82,17 +89,10 @@ - (void)mapViewDidLoad:(AGSMapView *)mapView {
#pragma mark AGSCalloutDelegate

- (void) didClickAccessoryButtonForCallout:(AGSCallout *) callout {
//save selected graphic to assign it to the results view controller
self.selectedGraphic = (AGSGraphic*) callout.representedObject;

AGSGraphic* graphic = (AGSGraphic*) callout.representedObject;
//The user clicked the callout button, so display the complete set of results
ResultsViewController *resultsVC = [[ResultsViewController alloc] initWithNibName:@"ResultsViewController" bundle:nil];

//set our attributes/results into the results VC
resultsVC.results = [graphic allAttributes];

//display the results vc modally
[self presentViewController:resultsVC animated:YES completion:nil];

[self performSegueWithIdentifier:kResultsSegueIdentifier sender:self];
}

#pragma mark - UISearchBarDelegate
Expand Down Expand Up @@ -262,5 +262,13 @@ - (void)viewDidUnload {
// e.g. self.myOutlet = nil;
}

#pragma mark - segues

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:kResultsSegueIdentifier]) {
ResultsViewController *controller = segue.destinationViewController;
controller.results = [self.selectedGraphic allAttributes];
}
}

@end
8 changes: 1 addition & 7 deletions FindTaskSample/Classes/FindTaskSampoleAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@

#import <UIKit/UIKit.h>

@class FindTaskSampleViewController;

@interface FindTaskSampoleAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
FindTaskSampleViewController *viewController;
}
@interface FindTaskSampoleAppDelegate : NSObject <UIApplicationDelegate>

@property (nonatomic, strong) IBOutlet UIWindow *window;
@property (nonatomic, strong) IBOutlet FindTaskSampleViewController *viewController;

@end

15 changes: 2 additions & 13 deletions FindTaskSample/Classes/FindTaskSampoleAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,11 @@


#import "FindTaskSampoleAppDelegate.h"
#import "FindTaskSampleViewController.h"

@implementation FindTaskSampoleAppDelegate

@synthesize window;
@synthesize viewController;


- (void)applicationDidFinishLaunching:(UIApplication *)application {

// Override point for customization after app launch
[window setRootViewController:viewController];
[window makeKeyAndVisible];
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}




@end
6 changes: 1 addition & 5 deletions FindTaskSample/Classes/ResultsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
#import <UIKit/UIKit.h>


@interface ResultsViewController : UIViewController {
NSDictionary *_results;
UITableView *_tableView;

}
@interface ResultsViewController : UIViewController

//results are the attributes of the result of the geocode operation
@property (nonatomic, strong) NSDictionary *results;
Expand Down
7 changes: 5 additions & 2 deletions FindTaskSample/Classes/ResultsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@

@implementation ResultsViewController

@synthesize results = _results;
@synthesize tableView = _tableView;
// in iOS7 this gets called and hides the status bar so the view does not go under the top iPhone status bar
- (BOOL)prefersStatusBarHidden
{
return YES;
}

- (IBAction)done:(id)sender
{
Expand Down
Loading

0 comments on commit ddcc4b3

Please sign in to comment.