Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding some finishing touches to formatting for easy web viewing

  • Loading branch information...
commit 63416c0452976330329cccc5bee90887f2273a1d 1 parent 45e6e9e
sjbyrd authored
Showing with 72 additions and 74 deletions.
  1. +1 −1  CustomCell.m
  2. +71 −73 TableDataSource.m
View
2  CustomCell.m
@@ -53,7 +53,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
[self.fromCurrentBtn addTarget:self action:@selector(currentButtonFunction:) forControlEvents:UIControlEventTouchUpInside];
[self.fromPreviousBtn addTarget:self action:@selector(previousButtonFunction:) forControlEvents:UIControlEventTouchUpInside];
- UIImage* bgImg = [UIImage imageNamed:@"routeBackground.png"];
+ UIImage* bgImg = [UIImage imageNamed:@"routeBackground.png"];
UIImageView* backgroundImage = [[[UIImageView alloc] initWithImage:bgImg] autorelease];
[backgroundImage setFrame:CGRectMake(0,44,320,44)];
View
144 TableDataSource.m
@@ -10,10 +10,10 @@ @implementation TableDataSource
@synthesize editBtn;
-NSInteger selectedIndex;
+NSInteger selectedIndex;
NSIndexPath* oldPath;
-NSAlert* googleRouteAlert;
-NSAlert* prevLocationAlert;
+NSAlert* googleRouteAlert;
+NSAlert* prevLocationAlert;
#pragma mark -
#pragma mark UITableViewDelegate
@@ -127,8 +127,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
{
static NSString* shortCell = @"short";
static NSString* tallCell = @"tall";
- NSString* cellID = (indexPath.row == selectedIndex) ? tallCell : shortCell;
- CustomCell* cell = (CustomCell*)[tableView dequeueReusableCellWithIdentifier:cellID];
+ NSString* cellID = (indexPath.row == selectedIndex) ? tallCell : shortCell;
+ CustomCell* cell = (CustomCell*)[tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil)
{
@@ -138,49 +138,49 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
// Configure the cell...
NSDictionary* routeItem = [dataSource objectAtIndex:indexPath.row];
- NSString* cellValue = (NSString*)[routeItem objectForKey:@"name"];
+ NSString* cellValue = (NSString*)[routeItem objectForKey:@"name"];
[routeItem setValue:[NSString stringWithFormat:@"%d", (indexPath.row + 1)] forKey:@"routeStep"];
[cell setText:cellValue];
[cell setCurrentButtonPressed:^()
- {
- selectedLocation = indexPath.row;
-
- googleRouteAlert = [[[UIAlertView alloc] initWithTitle:@"Navigate"
- message:@"Open directions to this location in Google Maps?"
- delegate:self
- cancelButtonTitle:@"Cancel"
- otherButtonTitles:nil]
- autorelease];
+ {
+ selectedLocation = indexPath.row;
+
+ googleRouteAlert = [[[UIAlertView alloc] initWithTitle:@"Navigate"
+ message:@"Open directions to this location in Google Maps?"
+ delegate:self
+ cancelButtonTitle:@"Cancel"
+ otherButtonTitles:nil]
+ autorelease];
- //add a Yes button
- [googleRouteAlert addButtonWithTitle:@"Yes"];
+ //add a Yes button
+ [googleRouteAlert addButtonWithTitle:@"Yes"];
- [googleRouteAlert show];
- }];
+ [googleRouteAlert show];
+ }];
[cell setPreviousButtonPressed:^()
- {
- if (selectedIndex > 0)
- {
- selectedLocation = indexPath.row;
-
- prevLocationAlert = [[[UIAlertView alloc] initWithTitle:@"Navigate"
- message:@"Find directions from previous route location to this location in Google Maps?"
- delegate:self
- cancelButtonTitle:@"Cancel"
- otherButtonTitles:nil]
- autorelease];
-
- //add a Yes button
- [prevLocationAlert addButtonWithTitle:@"Yes"];
-
- [prevLocationAlert show];
- }
- }];
+ {
+ if (selectedIndex > 0)
+ {
+ selectedLocation = indexPath.row;
+
+ prevLocationAlert = [[[UIAlertView alloc] initWithTitle:@"Navigate"
+ message:@"Find directions from previous route location to this location in Google Maps?"
+ delegate:self
+ cancelButtonTitle:@"Cancel"
+ otherButtonTitles:nil]
+ autorelease];
+
+ //add a Yes button
+ [prevLocationAlert addButtonWithTitle:@"Yes"];
+
+ [prevLocationAlert show];
+ }
+ }];
[[cell fromPreviousBtn] setHidden:!(selectedIndex > 0)];
@@ -211,24 +211,23 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
{
if (buttonIndex == 1)
{
- UIApplication* app = [UIApplication sharedApplication];
- AppDelegate* delegate = (AppDelegate*)[app delegate];
- MapVC* mVC = [delegate mapVC];
- MKMapView* map = [mVC map];
- float userLat = map.userLocation.location.coordinate.latitude;
- float userLng = map.userLocation.location.coordinate.longitude;
- NSString* saddr = [NSString stringWithFormat:@"%f,%f", userLat, userLng];
- NSDictionary* selectedLoc = [dataSource objectAtIndex:selectedLocation];
- NSString* lat = [selectedLoc objectForKey:@"lat"];
- NSString* lng = [selectedLoc objectForKey:@"lng"];
- NSString* street = [selectedLoc objectForKey:@"street"];
- NSString* city = [selectedLoc objectForKey:@"city"];
- NSString* state = [selectedLoc objectForKey:@"state"];
- NSString* zip = [selectedLoc objectForKey:@"zip"];
- NSMutableString* daddr = [NSMutableString stringWithFormat:@"%@,%@",lat,lng];
+ UIApplication* app = [UIApplication sharedApplication];
+ AppDelegate* delegate = (AppDelegate*)[app delegate];
+ MapVC* mVC = [delegate mapVC];
+ MKMapView* map = [mVC map];
+ float userLat = map.userLocation.location.coordinate.latitude;
+ float userLng = map.userLocation.location.coordinate.longitude;
+ NSString* saddr = [NSString stringWithFormat:@"%f,%f", userLat, userLng];
+ NSDictionary* selectedLoc = [dataSource objectAtIndex:selectedLocation];
+ NSString* lat = [selectedLoc objectForKey:@"lat"];
+ NSString* lng = [selectedLoc objectForKey:@"lng"];
+ NSString* street = [selectedLoc objectForKey:@"street"];
+ NSString* city = [selectedLoc objectForKey:@"city"];
+ NSString* state = [selectedLoc objectForKey:@"state"];
+ NSString* zip = [selectedLoc objectForKey:@"zip"];
+ NSMutableString* daddr = [NSMutableString stringWithFormat:@"%@,%@",lat,lng];
- if (([street length] > 0) &&
- ([city length] > 0))
+ if (([street length] > 0) && ([city length] > 0))
{
[daddr setString:@""];
@@ -267,22 +266,21 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
{
if (buttonIndex == 1)
{
- UIApplication* app = [UIApplication sharedApplication];
- NSDictionary* prevLoc = [dataSource objectAtIndex:selectedIndex - 1];
- NSString* prevLat = [prevLoc objectForKey:@"lat"];
- NSString* prevLng = [prevLoc objectForKey:@"lng"];
- NSString* saddr = [NSString stringWithFormat:@"%@,%@", prevLat, prevLng];
- NSDictionary* selectedLoc = [dataSource objectAtIndex:selectedLocation];
- NSString* lat = [selectedLoc objectForKey:@"lat"];
- NSString* lng = [selectedLoc objectForKey:@"lng"];
- NSString* street = [selectedLoc objectForKey:@"street"];
- NSString* city = [selectedLoc objectForKey:@"city"];
- NSString* state = [selectedLoc objectForKey:@"state"];
- NSString* zip = [selectedLoc objectForKey:@"zip"];
- NSMutableString* daddr = [NSMutableString stringWithFormat:@"%@,%@",lat,lng];
+ UIApplication* app = [UIApplication sharedApplication];
+ NSDictionary* prevLoc = [dataSource objectAtIndex:selectedIndex - 1];
+ NSString* prevLat = [prevLoc objectForKey:@"lat"];
+ NSString* prevLng = [prevLoc objectForKey:@"lng"];
+ NSString* saddr = [NSString stringWithFormat:@"%@,%@", prevLat, prevLng];
+ NSDictionary* selectedLoc = [dataSource objectAtIndex:selectedLocation];
+ NSString* lat = [selectedLoc objectForKey:@"lat"];
+ NSString* lng = [selectedLoc objectForKey:@"lng"];
+ NSString* street = [selectedLoc objectForKey:@"street"];
+ NSString* city = [selectedLoc objectForKey:@"city"];
+ NSString* state = [selectedLoc objectForKey:@"state"];
+ NSString* zip = [selectedLoc objectForKey:@"zip"];
+ NSMutableString* daddr = [NSMutableString stringWithFormat:@"%@,%@",lat,lng];
- if (([street length] > 0) &&
- ([city length] > 0))
+ if (([street length] > 0) && ([city length] > 0))
{
[daddr setString:@""];
@@ -326,7 +324,7 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
-(void)viewDidAppear:(BOOL)animated
{
- selectedIndex = -1;
+ selectedIndex = -1;
[table reloadData];
}
@@ -347,7 +345,7 @@ -(void)viewDidLoad
- (void)didReceiveMemoryWarning
{
- [super didReceiveMemoryWarning];
+ [super didReceiveMemoryWarning];
}
@@ -355,7 +353,7 @@ - (void)didReceiveMemoryWarning
- (void)viewDidUnload
{
- [super viewDidUnload];
+ [super viewDidUnload];
}
@@ -382,7 +380,7 @@ - (void)dealloc
[prevLocationAlert release];
}
- [super dealloc];
+ [super dealloc];
}
Please sign in to comment.
Something went wrong with that request. Please try again.