2016-06-25 2 views
0

자동 완성 API에서 Google 지역 정보를로드 한 다음 내지도를 확대하려면 장소 세부 정보를 찾습니다.GMSMapView가 확대되지 않음

내보기 컨트롤러를 실행할 때 볼 수있는 내 XIB에 GMSMapView이 정의되어 있습니다.

원래 줌 레벨은 내가 좌표와 줌 레벨을 설정하면, 그것은 내가 확대 어떻게 줌 레벨이 2

이다 말을 내 디버거에도 불구하고 축소 상태를 유지 4. 에있다?

(lldb) po self.map 
<GMSMapView: 0x7f8c62a9ebc0; frame = (0 73.3333; 414 576.667); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7f8c67029fc0>; layer = <GMSMapLayer: 0x7f8c62a57aa0>> 

(lldb) po self.map.camera 
GMSCameraPosition 0x7f8c62d2d030: target:(29.741, -95.374) bearing:0.000 zoomLevel:2.000 viewingAngle:0.000 


- (void)viewDidLoad { 
    [super viewDidLoad]; 
    [self setupButtons]; 

    self.map.delegate = self; 

    self.client = [GMSPlacesClient sharedClient]; 
    [self.client lookUpPlaceID:self.prediction.placeID callback:^(GMSPlace * _Nullable result, NSError * _Nullable error) { 
     [self showResult:result]; 
    }]; 
} 

- (void)showResult:(GMSPlace *)place { 
    self.place = place; 

GMSCameraPosition *position = [[GMSCameraPosition alloc] initWithTarget:place.coordinate zoom:0.2 bearing:0 viewingAngle:0]; 
    [self.map setCamera:position]; 
    [self.map animateWithCameraUpdate:[GMSCameraUpdate setTarget:place.coordinate zoom: 0.15]]; 

    [self.map moveCamera:[GMSCameraUpdate setTarget:place.coordinate zoom: 0.15]]; 
} 
+0

'setCamera :'또는'[self.map animateWithCameraUpdate : [GMSCameraUpdate setTarget : place.coordinate zoom : 0.15]]와 같은 메소드를 사용해 보셨습니까? – emotality

+0

animateWithCameraUpdate 및 setCamera 시도했습니다 - 위에서 편집 한 ^ – quantumpotato

답변

0

여기 뭔가 잘못하고있는 것 같습니다. 당신은 내가 좌표와 줌 레벨을 설정하면

원래 줌 레벨이 줌 레벨을 말하는 내 디버거에도 불구하고 축소 상태로 유지, 4. 2.

것은 그냥 명확하게하는 것입니다라고 말했다 , 줌 레벨 4는> 줌 레벨 2입니다. 맵을 확대하려면 15, 16 등의 더 높은 값을 사용하십시오.

희망이 있습니다.

0

당신은 GMSMapView의에 animateToZoom:과 프로그래밍 zoom을 설정할 수 있습니다.

샘플 코드는 다음과 같습니다

과는 별도로

mapView.animateToZoom(12)

, 당신은 또한 RA를 제한 할 수 있습니다

[mapView_ animateToZoom:12];

스위프트

목표 - C 최소 및 최대 줌 레벨을 설정하여지도에서 사용할 수있는 확대/축소 범위. 줌 범위는 setMinZoom:maxZoom: 방법을 사용하여 설정해야하지만 minZoommaxZoom 속성을 사용하여 값을 개별적으로 읽을 수 있습니다. 이는 값 중 하나만 제한 할 때 유용합니다.

해당 설명서에서 샘플 코드를 찾을 수 있으며지도와 관련된 다른 방법으로 GMSMapView Class Reference을 사용할 수도 있습니다.

그리고이 SO 게시물 - GMSMapView animateToCameraPosition zoom in - zoom out animation도 도움이 될 수 있습니다.

관련 문제