I would like my MKMapView to rotate based on heading which is set progmatically.
All I have been able to do is rotate the view itself but then of course the street names, etc are upside down.
Can someone please help me out?
It does not appear to me that you can manually set the heading for the map view. You can set the behavior that rotates the map view to follow the user's current compass heading, though:
[mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading
animated:YES];
This question is old so many things have changed until. But there is definetly the possibility like so in swift:
mapView.camera.heading = 0
Related
On first time load, it's working fine and move along with MapView, but if I change the marker position and then if I drag the map view that marker is not moving with map.it's just stuck on that place. It's only happening in iOS 11 or below that version.
See the screenshot its just stuck that place.moving mapview.
I don't know that this will work, but you can change coordinate of annoation use
[yourAnnotation setCoordinate:newCoordinate];
Pls see if this SO question helps you MKMapView moving Annotations Automatically - animate them ?
I have just build an swift app that takes data+coords from dynamoDB and puts it onto the ios mapkit. There are two sets of coords: one for current user location and one from dynamoDB. I want these coords to be able to update inside the map, but do not want the actual mapView to zoom and move at all (only the user can zoom and move).
I have achieved everything above except the last part. Currently whenever the annotations are added and mapView.showAnnotations is called, the mapView zooms and moves to enclose the annotations. How do I disable this?
To show mapView annotations without updating mapView zoom and constraints, use addAnnotations() rather than showAnnotations.
I am guessing that you used code from online (which we all do, no worries) and that your code looked something like this. If I am right, then you likely have a line somewhere like this:
[map setRegion:scaledRegion animated:YES];
That line is the issue. You need to use some sort of boolean to make it so that it only happens once. So you could set the boolean has_mapped = false until you have called your update method once, at which point it = true. Then change your line to say something like,
if (has_mapped)
[map setRegion:scaledRegion animated:YES];
hi i am using skobbler offline map in my application and everything works fine except one thing, after starting navigation i am able to rotate, zoom in, zoom out in the map but cannot move the map please help solving this. if i set follow user position to NO it works fine but i have to follow user position while in navigation. i had already tried this
Not able to move map after starting Navigation SKMAPS but i want follow user position to be YES .please help thanks in advance
[SKRoutingService sharedInstance].navigationDelegate = self;
SKNavigationSettings* navSettings = [SKNavigationSettings navigationSettings];
navSettings.navigationType=SKNavigationTypeReal;
navSettings.distanceFormat=SKDistanceFormatMilesFeet;
[[SKRoutingService sharedInstance]startNavigationWithSettings:navSettings];
self.mapView.settings.followUserPosition = YES;
self.mapView.settings.displayMode = SKMapDisplayMode2D;
I think that these 2 requirements are conflicting:
you want to be able to pan the map - this means that you should be able to move where ever you want on the map disregarding the current user position
you want to follow the user position - this means that the map should automatically recenter on the user every time the user position is updated
From my view you can switch between these 2 scenarios (see for example the "Car navigation UI" example in the skobbler/Telenav demo project - there once you start panning the map you go to 2D without following the user position and when you click the "back" button you switch back to 3D navigation following the user position) but you can't have both at the same time (as they are logically exclusive).
If I'm missing a specific use case let me know
using target 8.0 MapKit, I would like to define an MKAnnotation (such as a pin, or a custom one) that remains fixed on the center of the map view as the user moves the map around. Once the user stops moving the map, I would like to be able to read the new coordinates of the annotation. How can I do this? This in swift, thank you soo much
You can follow this link to accomplish this task.They are doing something very similar to your requirement. Its quite descriptive. Link
I'm working on an app that shows a couple of places on the map along with the user's current position.
I have two small problems with it:
First off, I want the current location pin to be the default blue circle, but it shows a green pin just like the other locations.
Second problem, whenever I touch the screen, the current location pin drops again. It just can't seem to be steady like the other ones. It's like it's being called whenever I interact with the app.
Make sure you set your mapView delegate to self...that should fix the pin color. Not sure about your other problem
// in the viewDidLoad
[mapView setDelegate:self];
where "mapView" is defined as "IBOutlet MKMapView *mapView;"