Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set center location of GMSMapView object defined at Storyboard
    primarykey
    data
    text
    <p>I want to initialise the center of the map to a custom location. Here is the code that I use for initialization:</p> <pre><code>-(void)viewDidLoad{ [super viewDidLoad]; //mapView GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:41.0109 longitude:28.998 zoom:6]; self.mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera]; [self.mapView setCenter:CGPointMake(41.0109,28.998)]; } </code></pre> <p>When I run this code, I saw a map centered to the Greenwich rather than the position that I gave to the camera(41.0109,28.998). </p> <p>When I debug the code and print out the position of self.mapView.camera this is the output: <code>GMSCameraPosition 0x17742ee0: target:(41.011, 28.998) bearing:0.000 zoomLevel:6.000 viewingAngle:0.000 lookAhead:0.000</code>. So I successfully set the location of the camera, why does it opening with the location of Greenwich?</p> <p><strong>Edit:</strong></p> <p>Please note that, mapView is a subview (UIView) that I added to the main page and I was trying to set and modify the center location. Here is a snapshot of my storyboard: <img src="https://i.stack.imgur.com/ExWHI.png" alt="enter image description here"></p> <p>When I try to modify mapView, I cannot set the location of the map. However, if I use the "view" which is the main view of the window, I can successfully change the center of the map.</p> <p>Why is the reason for that?</p> <p>How can I set the startup position of GMSMapView?</p> <p><strong>Edit 2</strong> The source code for this project can be found <a href="https://github.com/ankakusu/setCenter" rel="nofollow noreferrer">here</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload