Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-17-2010, 10:41 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 92
funkyspider is on a distinguished road
Default Map drag pin

Has anyone found out how to move an annotation pin with the MapKit.

I've come across this with a downloadable project but found it doesn't work unfortunately - sometime the pin wont drag, sometimes I get multiple pins where it drags one and leaves the other etc.

Hollow Out: MapKit annotation drag and drop with callout info update


What I'm after is allowing the user to find their current location, drawing a pin rather than the standard blue marker, but want them to be able to move the pin for better accuracy. Current location and a annotation pin etc is no problem, it's just moving the pin.
funkyspider is offline   Reply With Quote
Old 04-26-2011, 12:56 AM   #2 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 4
hbastan is on a distinguished road
Default Am also looking for the same if you find anthg please update

Quote:
Originally Posted by funkyspider View Post
Has anyone found out how to move an annotation pin with the MapKit.

I've come across this with a downloadable project but found it doesn't work unfortunately - sometime the pin wont drag, sometimes I get multiple pins where it drags one and leaves the other etc.

Hollow Out: MapKit annotation drag and drop with callout info update


What I'm after is allowing the user to find their current location, drawing a pin rather than the standard blue marker, but want them to be able to move the pin for better accuracy. Current location and a annotation pin etc is no problem, it's just moving the pin.


Am also looking for the same if you find anthg please update...
hbastan is offline   Reply With Quote
Old 08-23-2011, 02:57 AM   #3 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 59
lxLionHartxl is on a distinguished road
Default

MKPinkAnnotationView *pin = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:[annotation title]];

pin.animatesDrop = YES;
pin.canShowCallout = YES;
pin.draggable = YES;

continue your coding from there forth
lxLionHartxl is offline   Reply With Quote
Old 01-26-2012, 12:38 PM   #4 (permalink)
Registered Member
 
Join Date: Jan 2012
Posts: 4
Ricardogilson is on a distinguished road
Default

You can add other images in place of the pin. Look here
Ricardogilson is offline   Reply With Quote
Old 01-26-2012, 01:11 PM   #5 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by lxLionHartxl View Post
MKPinkAnnotationView *pin = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:[annotation title]];

pin.animatesDrop = YES;
pin.canShowCallout = YES;
pin.draggable = YES;

continue your coding from there forth
Huh. Our company's navigation app is written to support iOS 3.0 (The soon-to-be-released update will move that up to 3.2). Thus I had to implement pin dragging without that property, which was added in iOS 4. I didn't know about it though, since I never revisited that code since our approach works.

The way I did it was to create a custom subclass of MKAnnotationView that implements touchesBegan/touchesMoved/touchesEnded. In those methods I figure out the change in location, and update the annotation object on touchesEnded.

To the OP, note that the docs on the draggable property say:

Quote:
Setting this property to YES makes an annotation draggable by the user. If YES, the associated annotation object must also implement the setCoordinate: method. The default value of this property is NO.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 324
22 members and 302 guests
baja_yu, cgokey, chemistry, Domele, Duncan C, Fstuff, gbenna, givensur, heshiming, HowEver, iAppDeveloper, iphonedevshani, jbro, JoeRCruso, kapps11, mdpauley, n00b, newDev, seokwon lee, SLIC, stanny, WheyLabs
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,112
Posts: 402,874
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:31 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0