0

Google Map App has "directions to here" and "directions from here" like http://static.intomobile.com/wp-content/uploads/2008/10/iphone-22-os-google-maps-street-view-23.png

When I call contact page, can I add "directions to here" button into the info page of address book?

ABAddressBookRef addressBook = ABAddressBookCreate();
NSArray *allPeople = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
ABRecordRef person = ABAddressBookGetPersonWithRecordID(addressBook, (ABRecordID) iRecordNo);

ABPersonViewController *personController = [[ABPersonViewController alloc] init];

personController.addressBook = addressBook;
personController.displayedPerson = person;
personController.allowsEditing = YES;       

[self.navigationController pushViewController:personController animated:YES];

[personController release]; 
dobiho
  • 1,025
  • 1
  • 11
  • 22

1 Answers1

0
"http://maps.google.com/maps?daddr=%f,%f&saddr=%f,%f",userLatitude,userLongitude,targetLatitude,targetLongitude


-(void)goToMaps{

[[UIApplication sharedApplication]openURL:url];//the url i gave you above
NSLog(@"the URL for directions is %@", [url absoluteString]);

}
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

if (indexPath.row == x) {//whatever row in the table it is on
    [self goToMaps];
}

}

Jordan Brown
  • 638
  • 1
  • 5
  • 14
  • Thank you for your answer, do you have any idea how to add [directions to here] button to contact's page? when click button on contact, google map app can be popped up. – dobiho Jun 28 '11 at 06:08
  • thats how you do it, but ill add it in context – Jordan Brown Jun 28 '11 at 14:42