Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Can't set zoom or coordinateCenter properties of RMMapView that was instantiated in a storyboard #588

Open
DanPen opened this issue Feb 19, 2015 · 2 comments

Comments

@DanPen
Copy link

DanPen commented Feb 19, 2015

Similar to #386

I am unable to set the zoom or coordinate center of a RMMapView view that I created in a storyboard.

[RMConfiguration sharedInstance].accessToken = @"ACCESS TOKEN";
RMMapboxSource * mapSource = [[RMMapboxSource alloc] initWithMapID: @"MAP ID"];
[mapView setTileSource: mapSource];

mapView.zoom = 5;
mapView.centerCoordinate = CLLocationCoordinate2DMake(19.279, -99.166);

mapView is defined as @property (weak, nonatomic) IBOutlet RMMapView *mapView;

This is what gets written to the console:

2015-02-19 13:46:49.989 AppName[3728:97301] Using watermarked example map ID examples.map-z2effxa8. Please go to https://mapbox.com and create your own map style.
2015-02-19 13:46:49.992 AppName[3728:97301] Added the tilesource 'Untitled project' to the container
2015-02-19 13:46:49.994 AppName[3728:97301] Map initialised. tileSource:RMMapboxSource: Mapbox iOS Example, zooms 0-19, no interactivity, minZoom:0.000000, maxZoom:19.000000, zoom:19.000000 at {-77.032458,38.913175}

@bilby91
Copy link

bilby91 commented Mar 26, 2015

Try moving that code to viewDidAppear or call it with a dispatch_async in the main queue. After updating to 1.6 I started having the same issue. Some layout calls happen that move the position of the map I think.

@Svantulden
Copy link

I had the same problem. The way I fixed it is by re-initializing the mapView in code with the bounds of the storyboard view.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants