2014-04-03 56 views
3

我試圖開發一個應用程序,讓用戶在地圖上改變其位置。我實際上有一個標記,它在mapView:didChangeCameraPosition事件中重新定位到地圖相機的位置,並且它工作正常,但是我看到的問題是性能不夠好,因爲標記在地圖上重新繪製了一些延遲。Google Maps SDK for IOS - 標記始終居中

我想知道是否有實現這一要求

這裏是我的實際代碼更好的方法:

- (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position { 
     self.marker.position = position.target; 
    } 

回答

2

你能不能增加一個UIImageView與標記,在頂部定位在它的中間的GMSMapView

+0

我想他可能需要標記附帶的標註 – Nerkatel

+0

@Nerkatel是的,但他也可以手動進行標註。 –

+0

它可以工作,但是,有沒有一種方法直接涉及到GMSMarker的使用?我問,因爲我也需要這個標記在某些動作被觸發時處於地圖中的某個靜態位置 – Juan

0
NSString *strLat = [NSString stringWithFormat:@"%f",_message.latitude]; 
NSString *strLong = [NSString stringWithFormat:@"%f",_message.longitude]; 
NSString *strURL = [NSString stringWithFormat:@"%@center=%@,%@&zoom=15&size=200x200&markers=color:red%%7Clabel:C%%7C%@,%@&key=%@",https://maps.googleapis.com/maps/api/staticmap?,strLat,strLong,strLat,strLong,GOOGLE_API_BROWSER_KEY]; 
NSLog(@"strURL %@",strURL); 
strURL = [strURL stringByReplacingOccurrencesOfString:@"%%" withString:@"%"]; 
相關問題