Changing the size of Google Map View for iOS

0

I'm using the Google Map SDK for iOS in a project, but when using the service by default it covers the entire screen. But I need space to add a few buttons on the screen.

How can I resize the map view?

Currently using the default code:

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude
                                                            longitude:longitude
                                                                 zoom:17];
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
    mapView_.myLocationEnabled = YES;


    self.view = mapView_;

    // Creates a marker in the center of the map.
    GMSMarker *marker = [[GMSMarker alloc] init];
    marker.position = CLLocationCoordinate2DMake(latitude, longitude);
    marker.title = nomeCliente;
    marker.snippet = @"Detalhes";
    marker.map = mapView_;

With this code it looks like this:

ButIneedyoutolooklikethis:

    
asked by anonymous 28.11.2014 / 00:00

1 answer

1

For this question I made the following code changes:

// Criei uma nova posição e novas dimensões
CGRect rect = CGRectMake(0, 0, 300, 300);


    // Create a GMSCameraPosition that tells the map to display the
    // coordinate -33.86,151.20 at zoom level 6.
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude
                                                            longitude:longitude
                                                                 zoom:17];

    // Utilizei a nova posição e dimensão e usei para alterar os valores de mapView_ 
    mapView_ = [GMSMapView mapWithFrame:rect camera:camera];
    mapView_.myLocationEnabled = YES;


    //self.view = mapView_;

    [self.view addSubview:mapView_];

    // Creates a marker in the center of the map.
    GMSMarker *marker = [[GMSMarker alloc] init];
    marker.position = CLLocationCoordinate2DMake(latitude, longitude);
    marker.title = nomeCliente;
    marker.snippet = @"Detalhes";
    marker.map = mapView_;

Although I myself was able to solve it quickly, I asked the question since I had already done other tests and modifications.

    
28.11.2014 / 00:12