调用Iphone中默认地图的导航功能

来源:互联网 发布:淘宝打印机 怎么设置 编辑:程序博客网 时间:2024/05/01 17:55

    CLLocationCoordinate2D toPlace;

    toPlace.latitude = [lastStr doubleValue];

    toPlace.longitude = [longStr doubleValue];

    MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];

    MKMapItem *toLocation = [[MKMapItem alloc]initWithPlacemark:[[MKPlacemark        alloc]initWithCoordinate:toPlace addressDictionary:nil]];

    toLocation.name = self.poi.name;

    [MKMapItem openMapsWithItems:[NSArray arrayWithObjects:currentLocation,toLocation, nil] launchOptions:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:MKLaunchOptionsDirectionsModeDriving,[NSNumber numberWithBool:YES],nil] forKeys:[NSArray arrayWithObjects:MKLaunchOptionsDirectionsModeKey,MKLaunchOptionsShowsTrafficKey,nil]]];

    


0 0
原创粉丝点击