diff --git a/TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj b/TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj index ee35a70..2f77602 100644 --- a/TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj +++ b/TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj @@ -9,10 +9,13 @@ /* Begin PBXBuildFile section */ 8D7DCD4B1BAF859400A92AD2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD4A1BAF859400A92AD2 /* main.m */; }; 8D7DCD4E1BAF859400A92AD2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */; }; - 8D7DCD511BAF859400A92AD2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD501BAF859400A92AD2 /* ViewController.m */; }; 8D7DCD541BAF859400A92AD2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D7DCD521BAF859400A92AD2 /* Main.storyboard */; }; 8D7DCD561BAF859400A92AD2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D7DCD551BAF859400A92AD2 /* Assets.xcassets */; }; 8D7DCD591BAF859400A92AD2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D7DCD571BAF859400A92AD2 /* LaunchScreen.storyboard */; }; + AB665E611BB67FA000DE3C50 /* InstagramPost.m in Sources */ = {isa = PBXBuildFile; fileRef = AB665E601BB67FA000DE3C50 /* InstagramPost.m */; settings = {ASSET_TAGS = (); }; }; + AB6E6E5D1BB4B10300756BD8 /* ListOfLocationsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB6E6E5C1BB4B10300756BD8 /* ListOfLocationsTableViewController.m */; settings = {ASSET_TAGS = (); }; }; + AB6E6E601BB4B12200756BD8 /* DetailLocationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB6E6E5F1BB4B12200756BD8 /* DetailLocationViewController.m */; settings = {ASSET_TAGS = (); }; }; + AB6E6E631BB4BA7000756BD8 /* API Manager.m in Sources */ = {isa = PBXBuildFile; fileRef = AB6E6E621BB4BA7000756BD8 /* API Manager.m */; settings = {ASSET_TAGS = (); }; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -20,12 +23,18 @@ 8D7DCD4A1BAF859400A92AD2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8D7DCD4F1BAF859400A92AD2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 8D7DCD501BAF859400A92AD2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 8D7DCD531BAF859400A92AD2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 8D7DCD551BAF859400A92AD2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 8D7DCD581BAF859400A92AD2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 8D7DCD5A1BAF859400A92AD2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB665E5F1BB67FA000DE3C50 /* InstagramPost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstagramPost.h; sourceTree = ""; }; + AB665E601BB67FA000DE3C50 /* InstagramPost.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstagramPost.m; sourceTree = ""; }; + AB6E6E5B1BB4B10300756BD8 /* ListOfLocationsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListOfLocationsTableViewController.h; sourceTree = ""; }; + AB6E6E5C1BB4B10300756BD8 /* ListOfLocationsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListOfLocationsTableViewController.m; sourceTree = ""; }; + AB6E6E5E1BB4B12200756BD8 /* DetailLocationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailLocationViewController.h; sourceTree = ""; }; + AB6E6E5F1BB4B12200756BD8 /* DetailLocationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailLocationViewController.m; sourceTree = ""; }; + AB6E6E611BB4BA7000756BD8 /* API Manager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "API Manager.h"; sourceTree = ""; }; + AB6E6E621BB4BA7000756BD8 /* API Manager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "API Manager.m"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -60,8 +69,14 @@ children = ( 8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */, 8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */, - 8D7DCD4F1BAF859400A92AD2 /* ViewController.h */, - 8D7DCD501BAF859400A92AD2 /* ViewController.m */, + AB6E6E611BB4BA7000756BD8 /* API Manager.h */, + AB6E6E621BB4BA7000756BD8 /* API Manager.m */, + AB6E6E5B1BB4B10300756BD8 /* ListOfLocationsTableViewController.h */, + AB6E6E5C1BB4B10300756BD8 /* ListOfLocationsTableViewController.m */, + AB6E6E5E1BB4B12200756BD8 /* DetailLocationViewController.h */, + AB6E6E5F1BB4B12200756BD8 /* DetailLocationViewController.m */, + AB665E5F1BB67FA000DE3C50 /* InstagramPost.h */, + AB665E601BB67FA000DE3C50 /* InstagramPost.m */, 8D7DCD521BAF859400A92AD2 /* Main.storyboard */, 8D7DCD551BAF859400A92AD2 /* Assets.xcassets */, 8D7DCD571BAF859400A92AD2 /* LaunchScreen.storyboard */, @@ -149,8 +164,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8D7DCD511BAF859400A92AD2 /* ViewController.m in Sources */, + AB6E6E631BB4BA7000756BD8 /* API Manager.m in Sources */, + AB6E6E601BB4B12200756BD8 /* DetailLocationViewController.m in Sources */, + AB6E6E5D1BB4B10300756BD8 /* ListOfLocationsTableViewController.m in Sources */, 8D7DCD4E1BAF859400A92AD2 /* AppDelegate.m in Sources */, + AB665E611BB67FA000DE3C50 /* InstagramPost.m in Sources */, 8D7DCD4B1BAF859400A92AD2 /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -262,7 +280,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = TalkinToTheNet/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.TalkinToTheNet; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -274,7 +292,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = TalkinToTheNet/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.TalkinToTheNet; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -300,6 +318,7 @@ 8D7DCD5F1BAF859400A92AD2 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/TalkinToTheNet/TalkinToTheNet/API Manager.h b/TalkinToTheNet/TalkinToTheNet/API Manager.h new file mode 100644 index 0000000..2e906c6 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/API Manager.h @@ -0,0 +1,18 @@ +// +// API Manager.h +// TalkinToTheNet +// +// Created by Bereket on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface API_Manager : NSObject + ++ (void)GETRequestWithURL:(NSURL *)URL + completionHandler:(void(^)(NSData *data, NSURLResponse *response, NSError *error))completionBlock; + + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/API Manager.m b/TalkinToTheNet/TalkinToTheNet/API Manager.m new file mode 100644 index 0000000..7cbb3eb --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/API Manager.m @@ -0,0 +1,32 @@ +// +// API Manager.m +// TalkinToTheNet +// +// Created by Bereket on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "API Manager.h" + +@implementation API_Manager + + + ++ (void)GETRequestWithURL:(NSURL *)URL + completionHandler:(void(^)(NSData *data, NSURLResponse *response, NSError *error))completionBlock { + + NSURLSession *session = [NSURLSession sharedSession]; + + NSURLSessionDataTask *task = [session dataTaskWithURL:URL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { + + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(data, response, error); + }); + }]; + + [task resume]; + +} + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/Base.lproj/LaunchScreen.storyboard b/TalkinToTheNet/TalkinToTheNet/Base.lproj/LaunchScreen.storyboard index 2e721e1..aa08113 100644 --- a/TalkinToTheNet/TalkinToTheNet/Base.lproj/LaunchScreen.storyboard +++ b/TalkinToTheNet/TalkinToTheNet/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,8 @@ - + - + + diff --git a/TalkinToTheNet/TalkinToTheNet/Base.lproj/Main.storyboard b/TalkinToTheNet/TalkinToTheNet/Base.lproj/Main.storyboard index f56d2f3..69e60b7 100644 --- a/TalkinToTheNet/TalkinToTheNet/Base.lproj/Main.storyboard +++ b/TalkinToTheNet/TalkinToTheNet/Base.lproj/Main.storyboard @@ -1,25 +1,175 @@ - + - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + diff --git a/TalkinToTheNet/TalkinToTheNet/DetailLocationViewController.h b/TalkinToTheNet/TalkinToTheNet/DetailLocationViewController.h new file mode 100644 index 0000000..b97332a --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/DetailLocationViewController.h @@ -0,0 +1,26 @@ +// +// DetailLocationViewController.h +// TalkinToTheNet +// +// Created by Bereket on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "API Manager.h" + +@interface DetailLocationViewController : UIViewController + + +@property (nonatomic) NSString* queryPhrase; +@property (nonatomic) NSURL * url; +@property (nonatomic) NSURL * instagramURL; + + +-(void)fetchFourSquareData; + +@property (strong, nonatomic) IBOutlet UILabel *fourSquareAddressTextLabel; + +@property (strong, nonatomic) IBOutlet UIImageView *instagramImage; + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/DetailLocationViewController.m b/TalkinToTheNet/TalkinToTheNet/DetailLocationViewController.m new file mode 100644 index 0000000..c8501c1 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/DetailLocationViewController.m @@ -0,0 +1,173 @@ +// +// DetailLocationViewController.m +// TalkinToTheNet +// +// Created by Bereket on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// +#import "DetailLocationViewController.h" +#import "API Manager.h" +#import "InstagramPost.h" +@interface DetailLocationViewController () +@property (nonatomic) NSString *yourChoice; +@property (nonatomic) NSString* locationAddress; +@property (nonatomic) NSString *placeAddress; +@property (nonatomic) NSString *placeCity; +@property (nonatomic) NSString *placeState; +@property (nonatomic) NSString *placePostalCode; + +//-------------------------------------------------------------------------------------------------------- + +//@property (nonatomic) NSMutableArray* searchResults; + //INSTAGRAM CODE +@property (nonatomic) NSArray* instagramData; + +//------------------------------------------------------------------------------------------------------- + +@end + +@implementation DetailLocationViewController + + +- (void)viewDidLoad { + [super viewDidLoad]; + + NSLog(@"self.queryPhrase %@", self.queryPhrase); + + + + if ([self.queryPhrase isEqual: @"Waldorf Astoria"] ) + { + self.yourChoice = @"waldorfastoriahotel"; + } + else if([self.queryPhrase isEqual: @"Madame Tussauds"]){ + + self.yourChoice = @"madametussauds"; //..... // do the same thing as above + } + else if([self.queryPhrase isEqual: @"Wave Hill"]){ + + self.yourChoice = @"wavehill"; + } + + + NSString *urlString = [NSString stringWithFormat:@"https://api.foursquare.com/v2/venues/search?client_id=DQU1A2YJWRSRRIP1OM1LHRVRH4RLVBDCD11OTNGOQ2QRDNPH&client_secret=V2DXHM04GZDA1FKRGDLIPLEGZ3D0BP25GNN4XB4L1GSY3E2B&v=20130815&ll=40.7,-74&query=%@",self.yourChoice]; + +//----------------------------------------------------------------------------------------------------------------- + //INSTAGRAM CODE + NSString *instagramURLString = [NSString stringWithFormat:@"https://api.instagram.com/v1/tags/%@/media/recent?client_id=a6dff3072d344b3c8c645275dfdc8fa2", self.yourChoice]; + + +//----------------------------------------------------------------------------------------------------------------- + + + //encoded url + NSString *encodedString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + + //addedforinstagram + self.instagramURL= [NSURL URLWithString:instagramURLString]; + + self.url = [NSURL URLWithString:encodedString]; + NSLog(@"self.url %@", self.url); + + [self fetchFourSquareData]; + +//-------------------------------------------------------------------------------------------------------------- + //INSTAGRAM CODE + [self fetchInstagramData]; + +//--------------------------------------------------------------------------------------------------------------- + +} +-(void)fetchFourSquareData{ + NSLog(@"called this method"); + [API_Manager GETRequestWithURL:self.url completionHandler:^(NSData* data, NSURLResponse* response, NSError* error){ + + NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; + + NSArray *results = [[json objectForKey:@"response"] objectForKey:@"venues"]; + + for (NSDictionary* result in results){ + + + self.placeAddress = [[result objectForKey:@"location"] objectForKey:@"address"]; + self.placeCity = [[result objectForKey:@"location"] objectForKey:@"city"]; + self.placeState = [[result objectForKey:@"location"] objectForKey:@"state"]; + self.placePostalCode = [[result objectForKey:@"location"] objectForKey:@"postalCode"]; + + + + NSLog(@"The placeAddress is %@", self.placeAddress); + NSLog(@"The placeCity is %@", self.placeCity); + NSLog(@"The placeState is %@", self.placeState); + NSLog(@"The placePostalCode is %@", self.placePostalCode); + + + } + + self.fourSquareAddressTextLabel.text = [NSString stringWithFormat:@"%@, %@, %@, %@",self.placeAddress, self.placeCity,self.placeState, self.placePostalCode] ; + + + }]; + + +} + +//----------------------------------------------------------------------------------------------------------------- + + + + + //INSTAGRAM CODE +- (void)fetchInstagramData { + // helpful description of kCFStreamErrorDomainSSL http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ + + + // create an instagram url + + // fetch data from the instagram endpoint and print json response + [API_Manager GETRequestWithURL:self.instagramURL completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + + NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; + + NSLog(@"%@",json); + + NSArray* results = json[@"data"]; + + NSDictionary* firstJSONdataFromResults = [results firstObject]; + + InstagramPost* post= [[InstagramPost alloc] initWithJSON: firstJSONdataFromResults]; + + NSURL* imageURL = [NSURL URLWithString:post.urlString]; + + NSData *pictureData = [NSData dataWithContentsOfURL:imageURL]; + UIImage *picture = [UIImage imageWithData:pictureData]; + self.instagramImage.image = picture; + + + //reset my array + // self.searchResults = [[NSMutableArray alloc] init]; + + //loop through all JSON posts +// for (NSDictionary* result in results) { +// +// //add post to array + // InstagramPost* post= [[InstagramPost alloc] initWithJSON:result]; +// +// [self.searchResults addObject:post]; +// +// self.instagramImage.image = [self.searchResults firstObject]; +// } + // self.instagramImage.image = [self. firstObject]; + }]; +} +//----------------------------------------------------------------------------------------------------------------- + +/* + #pragma mark - Navigation + // In a storyboard-based application, you will often want to do a little preparation before navigation + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. + } + */ +@end diff --git a/TalkinToTheNet/TalkinToTheNet/Info.plist b/TalkinToTheNet/TalkinToTheNet/Info.plist index 6905cc6..0570093 100644 --- a/TalkinToTheNet/TalkinToTheNet/Info.plist +++ b/TalkinToTheNet/TalkinToTheNet/Info.plist @@ -2,6 +2,19 @@ + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExceptionDomains + + https://api.instagram.com + + NSTemporaryThirdPartyExceptionAllowsInsecureHTTPLoads + + + + CFBundleDevelopmentRegion en CFBundleExecutable diff --git a/TalkinToTheNet/TalkinToTheNet/InstagramPost.h b/TalkinToTheNet/TalkinToTheNet/InstagramPost.h new file mode 100644 index 0000000..6a1c469 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/InstagramPost.h @@ -0,0 +1,20 @@ +// +// InstagramPost.h +// TalkinToTheNet +// +// Created by Bereket on 9/26/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface InstagramPost : NSObject + +//@property (nonatomic) NSDictionary* images; + +@property (nonatomic) NSString* urlString; + +- (instancetype)initWithJSON:(NSDictionary*)json; + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/InstagramPost.m b/TalkinToTheNet/TalkinToTheNet/InstagramPost.m new file mode 100644 index 0000000..367d16a --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/InstagramPost.m @@ -0,0 +1,36 @@ +// +// InstagramPost.m +// TalkinToTheNet +// +// Created by Bereket on 9/26/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "InstagramPost.h" + +@implementation InstagramPost + +- (instancetype)initWithJSON:(NSDictionary *)json{ + if (self = [super init]){ + + + NSLog(@"%@",json); + + NSDictionary* imagesDictionary = [json objectForKey:@"images"]; + + + NSDictionary* lowResolutiondictionary = [imagesDictionary objectForKey:@"low_resolution"]; + + + self.urlString = [lowResolutiondictionary objectForKey:@"url"]; + + + return self; + + } + + return nil; +} + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/ListOfLocationsTableViewController.h b/TalkinToTheNet/TalkinToTheNet/ListOfLocationsTableViewController.h new file mode 100644 index 0000000..f18bf14 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/ListOfLocationsTableViewController.h @@ -0,0 +1,13 @@ +// +// ListOfLocationsTableViewController.h +// TalkinToTheNet +// +// Created by Bereket on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface ListOfLocationsTableViewController : UITableViewController +@property (nonatomic) NSString* selectedQuery; +@end diff --git a/TalkinToTheNet/TalkinToTheNet/ListOfLocationsTableViewController.m b/TalkinToTheNet/TalkinToTheNet/ListOfLocationsTableViewController.m new file mode 100644 index 0000000..be72a4c --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/ListOfLocationsTableViewController.m @@ -0,0 +1,121 @@ +// +// ListOfLocationsTableViewController.m +// TalkinToTheNet +// +// Created by Bereket on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "ListOfLocationsTableViewController.h" +#import "DetailLocationViewController.h" + +@interface ListOfLocationsTableViewController () + +@property (nonatomic) NSArray* ListOfLocationsArray; + +@end + +@implementation ListOfLocationsTableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.ListOfLocationsArray = @[@"Waldorf Astoria", @"Madame Tussauds", @"Wave Hill"]; + + // 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)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.ListOfLocationsArray.count; +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CellIdentifier" forIndexPath:indexPath]; + + cell.textLabel.text = self.ListOfLocationsArray[indexPath.row]; + + + + return cell; +} + + +//-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath{ +// +// +// UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; +// self.selectedQuery = selectedCell.detailTextLabel.text; +// +// NSLog(@"%@", self.selectedQuery); +//} +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + + +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + + + + NSIndexPath* indexPath = [self.tableView indexPathForSelectedRow]; + DetailLocationViewController* viewController = segue.destinationViewController; + viewController.queryPhrase = self.ListOfLocationsArray[indexPath.row]; + + + + + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/ViewController.m b/TalkinToTheNet/TalkinToTheNet/ViewController.m deleted file mode 100644 index cbefa29..0000000 --- a/TalkinToTheNet/TalkinToTheNet/ViewController.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// ViewController.m -// TalkinToTheNet -// -// Created by Michael Kavouras on 9/20/15. -// Copyright © 2015 Mike Kavouras. All rights reserved. -// - -#import "ViewController.h" - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -@end