2014-10-07 3 views
0

스토리 보드에보기를 추가 한 다음보기를 GMSMapView로 설정했습니다. 하지만지도의 위치 버튼과 나침반이 누락되었습니다. https://developers.google.com/maps/documentation/ios/start#adding_the_google_maps_sdk_for_ios_to_your_project의 지침을 사용하여 프로그래밍 방식으로 맵을 추가하면 맵 컨트롤이 나타납니다.Google지도 컨트롤이 없습니다.

.H 클래스

@interface MapController : UIViewController{ 

    IBOutlet GMSMapView *mapView_; 

} 

하는 .m 클래스

- (void)viewDidLoad { 
    [super viewDidLoad]; 

    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:mapView_.myLocation.coordinate.latitude longitude:mapView_.myLocation.coordinate.longitude zoom:1]; 

    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; 

    mapView_.myLocationEnabled = YES; 

    mapView_.settings.myLocationButton = YES; 
    mapView_.settings.compassButton = YES; 

} 

답변

2

이 나를 위해 잘 작동 ...

mapView_ = [GMSMapView mapWithFrame:self.mapView.bounds 
              camera:camera]; 

self.mapView는 스토리 보드에서보기입니다. 내가있는 viewDidLoad에서 코드 줄을 사용하는보기

+0

왜 자기가 필요합니까? –

+0

오, 대단히 감사합니다. 대단히 감사합니다! @SarathNeeravallil –

0

을 위해 함께 IBOutlet을 만들고 제대로 작동합니다

mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; 
mapView_.delegate = self; 
self.view = mapView_; 

mapView_.settings.myLocationButton = YES; 
mapView_.settings.compassButton = YES; 

이 또한 내가 outlet.It가 필요하지 않습니다 사용하지 마십시오.

관련 문제