Google MapSDKDemos의 코드를 사용하여 화면의 작은 사각형에 맵뷰의 크기를 조정하려했지만 아무런 효과가없는 것 같습니다. 여기 내 코드는 다음과 같습니다.Google지도 크기 조정 iOS
mapView = [[GMSMapView alloc] initWithFrame : CGRectZero]; mapView.camera = [GMSCameraPosition cameraWithLatitude : 38.98549782690282 경도 : -76.94636067188021 줌 : 17];
self.view = [[UIView alloc] initWithFrame:CGRectZero];
mapView.autoresizingMask =
UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
mapView.frame = self.view.frame;
mapView.clipsToBounds = YES;
mapView.myLocationEnabled = YES;
mapView.settings.tiltGestures = NO;
mapView.settings.zoomGestures = NO;
mapView.frame = CGRectMake(0,0, 10, 25);
[self.view addSubview:self.mapView];
두 번째 행부터 끝나는 행은 MapView를 작은 정사각형으로 제한해야하지만 여전히 전체 화면을 차지합니다.
나는 단지 이것을 시도하고 그것은 작동하지 않았다, 분명히 내 GMSServices.h 파일에 그 mapWithFrame 메서드가 없습니다. API를 다시 검사하여 [여기] (https://developers.google.com/maps/documentation/ios/map#add_a_map)를 보면 GMMapView 클래스를 사용하는 것 같습니다. 나는 당신이 말한 것은 확실하지 않지만 xcode는 GMSServices에서 mapWithFrame 메소드를 찾을 수 없다. (그리고 어느 쪽도 할 수 없다) – CSStudent
아, 미안하지만, 내 의견이 아니라 헤더에있는 그 코멘트에서부터 나왔다. 암호. 'GMSService'가 아닌'GMSMapView'에'mapWithFrame'을 호출해야합니다 (헤더의 주석이 잘못되었다고 생각합니다). 위의 코드를 업데이트했습니다. –
이것은 여전히 나에게 효과가있는 것 같지 않습니다. 직접 해보셨습니까? smallmap = {GMSMapView mapWithFrame : CGRectMake (0,0, 10, 25) camera : camera];'smallmap은 스토리 보드의 GMMapView이고 여전히 전체 화면을 차지합니다. – CSStudent