Skip to content
This repository
Browse code

Connected segment control with direction options. But G_TRAVEL_MODE_W…

…ALKING does not work now.
  • Loading branch information...
commit faca8053d65fe83258df1a48c535565d50ad9270 1 parent 6db3168
kishikawa katsumi authored
1  .gitattributes
... ... @@ -0,0 +1 @@
  1 +*.pbxproj -crlf -diff -merge
2  Classes/MapDirectionsViewController.h
@@ -19,11 +19,13 @@
19 19 NSString *startPoint;
20 20 NSString *endPoint;
21 21 NSArray *wayPoints;
  22 + UICGTravelModes travelMode;
22 23 }
23 24
24 25 @property (nonatomic, retain) NSString *startPoint;
25 26 @property (nonatomic, retain) NSString *endPoint;
26 27 @property (nonatomic, retain) NSArray *wayPoints;
  28 +@property (nonatomic) UICGTravelModes travelMode;
27 29
28 30 - (void)update;
29 31
2  Classes/MapDirectionsViewController.m
@@ -17,6 +17,7 @@ @implementation MapDirectionsViewController
17 17 @synthesize startPoint;
18 18 @synthesize endPoint;
19 19 @synthesize wayPoints;
  20 +@synthesize travelMode;
20 21
21 22 - (void)dealloc {
22 23 [routeOverlayView release];
@@ -64,6 +65,7 @@ - (void)update {
64 65 [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
65 66
66 67 UICGDirectionsOptions *options = [[[UICGDirectionsOptions alloc] init] autorelease];
  68 + options.travelMode = travelMode;
67 69 if ([wayPoints count] > 0) {
68 70 NSArray *routePoints = [NSArray arrayWithObject:startPoint];
69 71 routePoints = [routePoints arrayByAddingObjectsFromArray:wayPoints];
11 Classes/RootViewController.m
@@ -211,7 +211,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
211 211
212 212 travelModeSegment = [[UISegmentedControl alloc] initWithItems:
213 213 [NSArray arrayWithObjects:NSLocalizedString(@"Driving", nil),
214   - NSLocalizedString(@"Train", nil),
  214 + /*NSLocalizedString(@"Train", nil), */
215 215 NSLocalizedString(@"Walking", nil), nil]];
216 216 [travelModeSegment setFrame:CGRectMake(9.0f, 0.0f, 302.0f, 45.0f)];
217 217 travelModeSegment.selectedSegmentIndex = 0;
@@ -231,6 +231,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
231 231 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
232 232 if (indexPath.section == 2 && indexPath.row == 0) {
233 233 MapDirectionsViewController *controller = [[MapDirectionsViewController alloc] init];
  234 +
234 235 controller.startPoint = startField.text;
235 236 controller.endPoint = endField.text;
236 237 NSMutableArray *wayPoints = [NSMutableArray arrayWithCapacity:[wayPointFields count]];
@@ -238,8 +239,16 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
238 239 [wayPoints addObject:pointField.text];
239 240 }
240 241 controller.wayPoints = wayPoints;
  242 +
  243 + if (travelModeSegment.selectedSegmentIndex == 0) {
  244 + controller.travelMode = UICGTravelModeDriving;
  245 + } else {
  246 + controller.travelMode = UICGTravelModeWalking;
  247 + }
  248 +
241 249 [self.navigationController pushViewController:controller animated:YES];
242 250 [controller release];
  251 +
243 252 [tableView deselectRowAtIndexPath:indexPath animated:YES];
244 253 }
245 254 }
4 MapDirections.xcodeproj/project.pbxproj
@@ -388,7 +388,7 @@
388 388 GCC_WARN_ABOUT_RETURN_TYPE = YES;
389 389 GCC_WARN_UNUSED_VARIABLE = YES;
390 390 PREBINDING = NO;
391   - "PROVISIONING_PROFILE[sdk=iphoneos*]" = "F064D1B5-1E56-48D6-B621-293C692A49CE";
  391 + "PROVISIONING_PROFILE[sdk=iphoneos*]" = "91C7C51D-9A84-4BF5-AE22-DB7854C29849";
392 392 SDKROOT = iphoneos3.0;
393 393 };
394 394 name = Debug;
@@ -402,7 +402,7 @@
402 402 GCC_WARN_ABOUT_RETURN_TYPE = YES;
403 403 GCC_WARN_UNUSED_VARIABLE = YES;
404 404 PREBINDING = NO;
405   - "PROVISIONING_PROFILE[sdk=iphoneos*]" = "F064D1B5-1E56-48D6-B621-293C692A49CE";
  405 + "PROVISIONING_PROFILE[sdk=iphoneos*]" = "91C7C51D-9A84-4BF5-AE22-DB7854C29849";
406 406 SDKROOT = iphoneos3.0;
407 407 };
408 408 name = Release;
1  README
@@ -25,7 +25,6 @@ JSON Framework
25 25 -----------------
26 26 http://code.google.com/p/json-framework/
27 27
28   -
29 28 Toolbar Icons
30 29 -----------------
31 30 eddit, Inc.

0 comments on commit faca805

Please sign in to comment.
Something went wrong with that request. Please try again.