2017-09-29 3 views

Répondre

0

Essayez la fonction suivante. Je fais une fonction pour partager mon emplacement actuel.

-(NSURL *)funSetGoogleMapImage :(NSString *)str IMAGE:(UIImageView *)imgViewBounds LAT:(NSString *)strlatitude LONG:(NSString *)strLongitude 
{ 

    NSString *strImageResolution = @""; 
    if (ScreenWidth == 414) 
     strImageResolution = [NSString stringWithFormat:@"%.fx%.f",(imgViewBounds.bounds.size.width*3),imgViewBounds.bounds.size.height*3]; 
    else 
     strImageResolution = [NSString stringWithFormat:@"%.fx%.f",(imgViewBounds.bounds.size.width*2),imgViewBounds.bounds.size.height*2]; 

//define pin 
    NSString *strMarkerURl = [NSString stringWithFormat:@"icon:%@..../ws/images/[email protected]",MapImage]; 


//Return image of current location mapp 
    NSURL *ImgUrl=[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps/api/staticmap?center=%@,%@&markers=%@%@%@,%@&zoom=15&size=%@&scale=2&sensor=false",strlatitude,strLongitude,strMarkerURl,@"%7C",strlatitude,strLongitude,strImageResolution]]; 

    return ImgUrl; 
}