Permalink
Browse files

Connected segment control with direction options. But G_TRAVEL_MODE_W…

…ALKING does not work now.
  • Loading branch information...
1 parent 6db3168 commit faca8053d65fe83258df1a48c535565d50ad9270 @kishikawakatsumi committed Aug 31, 2009
View
@@ -0,0 +1 @@
+*.pbxproj -crlf -diff -merge
@@ -19,11 +19,13 @@
NSString *startPoint;
NSString *endPoint;
NSArray *wayPoints;
+ UICGTravelModes travelMode;
}
@property (nonatomic, retain) NSString *startPoint;
@property (nonatomic, retain) NSString *endPoint;
@property (nonatomic, retain) NSArray *wayPoints;
+@property (nonatomic) UICGTravelModes travelMode;
- (void)update;
@@ -17,6 +17,7 @@ @implementation MapDirectionsViewController
@synthesize startPoint;
@synthesize endPoint;
@synthesize wayPoints;
+@synthesize travelMode;
- (void)dealloc {
[routeOverlayView release];
@@ -64,6 +65,7 @@ - (void)update {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
UICGDirectionsOptions *options = [[[UICGDirectionsOptions alloc] init] autorelease];
+ options.travelMode = travelMode;
if ([wayPoints count] > 0) {
NSArray *routePoints = [NSArray arrayWithObject:startPoint];
routePoints = [routePoints arrayByAddingObjectsFromArray:wayPoints];
@@ -211,7 +211,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
travelModeSegment = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects:NSLocalizedString(@"Driving", nil),
- NSLocalizedString(@"Train", nil),
+ /*NSLocalizedString(@"Train", nil), */
NSLocalizedString(@"Walking", nil), nil]];
[travelModeSegment setFrame:CGRectMake(9.0f, 0.0f, 302.0f, 45.0f)];
travelModeSegment.selectedSegmentIndex = 0;
@@ -231,15 +231,24 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 2 && indexPath.row == 0) {
MapDirectionsViewController *controller = [[MapDirectionsViewController alloc] init];
+
controller.startPoint = startField.text;
controller.endPoint = endField.text;
NSMutableArray *wayPoints = [NSMutableArray arrayWithCapacity:[wayPointFields count]];
for (UITextField *pointField in wayPointFields) {
[wayPoints addObject:pointField.text];
}
controller.wayPoints = wayPoints;
+
+ if (travelModeSegment.selectedSegmentIndex == 0) {
+ controller.travelMode = UICGTravelModeDriving;
+ } else {
+ controller.travelMode = UICGTravelModeWalking;
+ }
+
[self.navigationController pushViewController:controller animated:YES];
[controller release];
+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
@@ -388,7 +388,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
- "PROVISIONING_PROFILE[sdk=iphoneos*]" = "F064D1B5-1E56-48D6-B621-293C692A49CE";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "91C7C51D-9A84-4BF5-AE22-DB7854C29849";
SDKROOT = iphoneos3.0;
};
name = Debug;
@@ -402,7 +402,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
- "PROVISIONING_PROFILE[sdk=iphoneos*]" = "F064D1B5-1E56-48D6-B621-293C692A49CE";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "91C7C51D-9A84-4BF5-AE22-DB7854C29849";
SDKROOT = iphoneos3.0;
};
name = Release;
View
1 README
@@ -25,7 +25,6 @@ JSON Framework
-----------------
http://code.google.com/p/json-framework/
-
Toolbar Icons
-----------------
eddit, Inc.

0 comments on commit faca805

Please sign in to comment.