Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

IOS MapKit change user location

Hi there, I'm using MapKit in Xcode/IOS to get my current location from the iPhone. I wanted to see if it was possible to change the current location if I were to drag/drop the pin. When I leave the current location on for the MapView it lets me drop the pin in a separate location and returns the lat and long, but when the pin is pressed again it returns to the phones current location. Now I tried turning off the current location when I press on the pin to drag it, but that sends the pin to 0 Lat and 0 Long (so out in the Atlantic, off the coast from Africa), all happening mid drag. So if anyone has some good ideas of what to try next let me know (cause I don't really want to switch over to googlemaps api after putting this much work into it). Thanks.

Hi Allan,

Thanks for asking me for input.

Massive apologies; I don't know the answer to your question as I am working on getting the Google API to work for me as I type! Once I've figured that out, I'll definitely get up to speed with iOS.

Maybe we can compare notes - my projects are in Github if you're interested. They don't work but that's just a small detail. ;-)

Steve.

Hello Allan,

Can you describe a little bit more about what you are trying to accomplish? I will be happy to help you out with it, just not sure exactly what your goal is. :-)

1 Answer

Oh, sorry for the late reply. I'm trying to make the location where the pin/annotation is dropped my current location. If I leave the show current location option on for the map view, I am always placed at the phones current location. So when you pull up the map view, the annotation is at your current location via the information from the iPhone, but what I want is when you drag it to a new location the lat/long/address are returned and that location is now the "current" address/location. I've gotten it to do all that except for when I try to move the annotation for a second time, it returns to the phones current location.