Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show a list of Gowalla spots around my current location and show chec…
…kins upon touching
- Loading branch information
1 parent
1dad4ad
commit d5bf1f1
Showing
5 changed files
with
117 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
GowallaExample/GowallaExample/View Controllers/CheckinsTableViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// CheckinsTableViewController.h | ||
// GowallaExample | ||
// | ||
// Created by Aaron Brethorst on 9/4/11. | ||
// Copyright 2011 Structlab LLC. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface CheckinsTableViewController : UITableViewController <Routable> | ||
@property(nonatomic,retain) NSMutableArray *tableData; | ||
@property(nonatomic,retain) NSString *apiPath; | ||
@end |
93 changes: 93 additions & 0 deletions
93
GowallaExample/GowallaExample/View Controllers/CheckinsTableViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// | ||
// CheckinsTableViewController.m | ||
// GowallaExample | ||
// | ||
// Created by Aaron Brethorst on 9/4/11. | ||
// Copyright 2011 Structlab LLC. All rights reserved. | ||
// | ||
|
||
#import "CheckinsTableViewController.h" | ||
|
||
@implementation CheckinsTableViewController | ||
@synthesize tableData; | ||
@synthesize apiPath; | ||
|
||
- (id)initWithStyle:(UITableViewStyle)style | ||
{ | ||
self = [super initWithStyle:style]; | ||
if (self) | ||
{ | ||
self.title = @"Checkins"; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
self.apiPath = nil; | ||
[super dealloc]; | ||
} | ||
|
||
#pragma mark - View lifecycle | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
|
||
self.tableData = [[[NSMutableArray alloc] init] autorelease]; | ||
|
||
[[AFGowallaAPIClient sharedClient] getPath:self.apiPath parameters:nil success:^(id response) { | ||
|
||
[self.tableData removeAllObjects]; | ||
[self.tableData addObjectsFromArray:[response objectForKey:@"activity"]]; | ||
[self.tableView reloadData]; | ||
}]; | ||
} | ||
|
||
- (void)viewDidUnload | ||
{ | ||
[super viewDidUnload]; | ||
self.tableData = nil; | ||
} | ||
|
||
#pragma mark - Table view data source | ||
|
||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | ||
{ | ||
return [self.tableData count]; | ||
} | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
static NSString *CellIdentifier = @"Cell"; | ||
|
||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | ||
if (cell == nil) { | ||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; | ||
} | ||
|
||
NSDictionary *activity = [self.tableData objectAtIndex:indexPath.row]; | ||
|
||
NSString *activityType = [activity objectForKey:@"type"]; | ||
NSString *activityUser = [[activity objectForKey:@"user"] objectForKey:@"first_name"]; | ||
|
||
cell.textLabel.text = [NSString stringWithFormat:@"%@ by %@", activityType, activityUser]; | ||
|
||
return cell; | ||
} | ||
|
||
#pragma mark - Table view delegate | ||
|
||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
// Navigation logic may go here. Create and push another view controller. | ||
/* | ||
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; | ||
// ... | ||
// Pass the selected object to the new view controller. | ||
[self.navigationController pushViewController:detailViewController animated:YES]; | ||
[detailViewController release]; | ||
*/ | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters