Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8742449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:30:08+00:00 2026-06-13T11:30:08+00:00

I have a mapView where users press to drop a pin. There may be

  • 0

I have a mapView where users press to drop a pin. There may be multiple pins at one time, and each annotation view has a callout that pushes a new view to the stack when it is pressed. What I want to do is pass the title of the annotation view to the label in the second view.

Here is the code where I drop the pin:

-(void)press:(UILongPressGestureRecognizer *)recognizer
{
    CGPoint touchPoint = [recognizer locationInView:worldView];
    CLLocationCoordinate2D touchMapCoordinate = [worldView convertPoint:touchPoint toCoordinateFromView:worldView];

    geocoder = [[CLGeocoder alloc]init];
    CLLocation *location = [[CLLocation alloc]initWithCoordinate:touchMapCoordinate
                                                    altitude:CLLocationDistanceMax
                                          horizontalAccuracy:kCLLocationAccuracyBest
                                            verticalAccuracy:kCLLocationAccuracyBest
                                                   timestamp:[NSDate date]];
    [geocoder reverseGeocodeLocation:location
               completionHandler:^(NSArray *placemarks, NSError *error) {
                   NSLog(@"reverseGeocoder:completionHandler: called");
                   if (error) {
                       NSLog(@"Geocoder failed with error: %@", error);
                   } else {
                       CLPlacemark *place = [placemarks objectAtIndex:0];
                       address = [NSString stringWithFormat:@"%@ %@, %@ %@", [place subThoroughfare], [place thoroughfare], [place locality], [place administrativeArea]];

                       if (UIGestureRecognizerStateBegan == [recognizer state]) {
                           addressPin = [[MapPoint alloc]initWithCoordinate:touchMapCoordinate
                                                                        title:address];
                           [worldView addAnnotation:addressPin];
                       }
                   }
               }];
}

And here is the code where I call the second view:

-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
   PinViewController *pinViewController = [[PinViewController alloc]init];
    [self passValues];
    [[self navigationController]pushViewController:pinViewController animated:YES];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:30:09+00:00Added an answer on June 13, 2026 at 11:30 am

    You can override MKAnnotation (for example MyLocation)and declare in MyLocation.h file

    #import <Foundation/Foundation.h>
    #import <MapKit/MapKit.h>
    
    @interface MyLocation : NSObject <MKAnnotation> {
        NSNumber *identyfier;
        NSString *_name;
        NSString *_address;
        CLLocationCoordinate2D _coordinate;
    }
    
    @property (copy) NSString *name;
    @property (copy) NSString *address;
    @property (copy) NSNumber *identyfier;
    @property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
    
    - (id)initWithName:(NSString*)name address:(NSString*)address 
        coordinate:(CLLocationCoordinate2D)coordinate identyfier:(NSNumber *) identyfier;
    

    @end

    in MyLocation.m file:

    #import "MyLocation.h"
    
    @implementation MyLocation
    
    @synthesize name = _name;
    @synthesize address = _address;
    @synthesize coordinate = _coordinate;
    @synthesize identyfier = _identyfier;
    
    - (id)initWithName:(NSString*)name address:(NSString*)address 
        coordinate:(CLLocationCoordinate2D)coordinate identyfier:(NSNumber *)identyfier {
        if ((self = [super init])) {
            _name = [name copy];
            _address = [address copy];
            _coordinate = coordinate;
            _identyfier = identyfier;
        }
        return self;
    }
    

    In your map view when you declare annotation use this methos:

    MyLocation *pin = [[MyLocation alloc] initWithName:place.name address:place.address coordinate:coordinate2D identyfier:some_id];
    

    So for example in your map delegate:

    - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
    

    you can use:

    ((MyLocation *)annotation).identyfier
    

    to check selected annotation (of course you can use different variables in MyLocation class)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a FrameLayout view which contains one (MapView-like) control and some additional buttons
I have created Custom Annotation with following: -(MKAnnotationView*)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { MKPinAnnotationView *view =
My application uses a MapView which will display multiple places. I have the latitude
I have a mapview with several annotations. Every annotation has a leftCalloutAccessoryView which is
I have a mapView outlet on my view (MKMapViewDelegate) with Shows user location enabled.
I have A MapView with multiple annotations. I need to put different images to
Is there a way to have the MapView not show my current location? I'm
I have a map view with pins annotations into it. I need to pass
I have a normal mapView, which can tell the users location, but when users
I have two views in my app, one is a general view where CoreLocation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.