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
// | |
// DOViewController.m | |
// LoginForm | |
// | |
// Created by David Olesch on 4/1/14. | |
// Copyright (c) 2014 David Olesch. All rights reserved. | |
// | |
#import "DOViewController.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
- (void)getAndDisplayTravelTime | |
{ | |
//create request | |
MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init]; | |
[request setSource:[[MKMapItem alloc] initWithPlacemark:self.origin]]; | |
[request setDestination:[[MKMapItem alloc] initWithPlacemark:self.destination]]; | |
[request setTransportType:MKDirectionsTransportTypeAutomobile]; | |
//send request | |
[[[MKDirections alloc] initWithRequest:request] calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse *response, NSError *error) { |
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
//DORouteMapViewController interface | |
@property (strong, nonatomic) MKPlacemark *origin; | |
@property (strong, nonatomic) MKPlacemark *destination; | |
//this method is called while transitioning from the search view to the map view | |
-(void)mapFromLocation:(NSString *)fromLocation toLocation:(NSString *)toLocation | |
{ | |
//geocode the from location and handle the returned placemark | |
[[[CLGeocoder alloc] init] geocodeAddressString:fromLocation completionHandler:^(NSArray *placemarks, NSError *error) { | |
//grab the first placemark and set it as the origin placemark |
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
//DOMainViewController.m | |
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"1.png"]]]; | |
//DOContactsTableViewController.h | |
UIImageView *backgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 44)]; | |
UIImage *backgroundImage = [[UIImage imageNamed:@"newsfeed_background.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10)]; | |
[backgroundView setImage:backgroundImage]; | |
backgroundView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; | |
[cell.contentView insertSubview:backgroundView belowSubview:cell.textLabel]; |
NewerOlder