Azhar
Azhar

Reputation: 20680

How to stop the pin to move along with map in MapKit

I have implemented Maps and Pin in to it but when I Drag map Pin also moves with it. I want to fix pin in the center location of screen and Drag underneath Map.

Currently I Drag pin and where I drop it tells its lattitude, Longitude points.

I want to stop the pin to move along with map.

enter image description here

Upvotes: 1

Views: 1084

Answers (2)

Pradeep Dahiya
Pradeep Dahiya

Reputation: 41

    UIImageView *imgVew = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_marker"]];
    imgVew.frame = CGRectMake(10, 30, 7, 17);
    imgVew.center=self.view.center;
    AppDelegate*appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [appDelegate.window addSubview:imgVew];

use this for your problem it will definitely work

Upvotes: 0

AlexWien
AlexWien

Reputation: 28747

This is not the idea of a map annotation. Annotaions have geographical coordinates, and therefore move with the map.

What you want is a custom view (which looks like a pin) which you add to the viewController as subView. Your custom view is then parallel to the mkMapKit in view Hierarchy, then such a view always stays on its screen coordinates.

Examples are: Cross hairs in the middle of the screen, ruler views, coordinates display, etc.

Upvotes: 4

Related Questions