本文介绍了如何添加“到这里的路线”按钮进入地址簿?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌地图应用程序有到这里的方向和从这里开始的指示,如

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]; 


推荐答案

"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];
}

}

这篇关于如何添加“到这里的路线”按钮进入地址簿?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 18:27