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 7896111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:48:34+00:00 2026-06-03T07:48:34+00:00

I have a mapView with a detail disclosure indicator that when touched needs to

  • 0

I have a mapView with a detail disclosure indicator that when touched needs to bring the MoreDetailViewController on the stack. At the moment it crashes with a unrecognized selector sent to instance error.

I’m trying to figure out how to call this method - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender from the disclosure indicator press.

Here’s the Map annotation code with the disclosure indicator:

- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
    MKPinAnnotationView *mapPin = nil;
    if(annotation != map.userLocation) 
    {
        static NSString *defaultPinID = @"defaultPin";
        mapPin = (MKPinAnnotationView *)[map dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
        if (mapPin == nil )
        {
            mapPin = [[MKPinAnnotationView alloc] initWithAnnotation:annotation 
                                                      reuseIdentifier:defaultPinID];
            mapPin.canShowCallout = YES;

            UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
            [disclosureButton addTarget:self action:@selector(prepareForSegue:) forControlEvents:UIControlEventTouchUpInside];

            mapPin.rightCalloutAccessoryView = disclosureButton;

        }
        else
            mapPin.annotation = annotation;

    }
    return mapPin;
}

Here’s the method that should be called:

// Do some customisation of our new view when a table item has been selected
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Make sure we're referring to the correct segue
    if ([[segue identifier] isEqualToString:@"ShowMoreInfo"]) {

        // Get reference to the destination view controller
        MoreDetailViewController *mdvc = [segue destinationViewController];


        [mdvc setSelectedItemName:[NSString stringWithFormat:@"%@", placeName.text]];
        [mdvc setSelectedItemAddress:[NSString stringWithFormat:@"%@", placeFormattedAddress.text]];

        [mdvc setSelectedItemWeb:[NSString stringWithFormat:@"%@", placeWebsite.text]];
        [mdvc setSelectedItemRating:[NSString stringWithFormat:@"%@", placeRating.text]];
  //      [mdvc setSelectedItemDistance:[NSString stringWithFormat:@"%@", placeDistance.text]];

    }
}
  • 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-03T07:48:35+00:00Added an answer on June 3, 2026 at 7:48 am

    prepareForSegue: and prepareForSegue:sender: are not the same methods. Also placeName and friends in your prepareForSegue:sender: method are unknown (or are ivars).

    I would radically change the prepareForSegue:sender: method and change it to

    - (void)showMoreInfo:(id)sender{
            // Get reference to the destination view controller
            MoreDetailViewController *mdvc = [segue destinationViewController];
    
    //define and set the placename and other variables
    
            [mdvc setSelectedItemName:[NSString stringWithFormat:@"%@", placeName.text]];
            [mdvc setSelectedItemAddress:[NSString stringWithFormat:@"%@", placeFormattedAddress.text]];
    
            [mdvc setSelectedItemWeb:[NSString stringWithFormat:@"%@", placeWebsite.text]];
            [mdvc setSelectedItemRating:[NSString stringWithFormat:@"%@", placeRating.text]];
      //      [mdvc setSelectedItemDistance:[NSString stringWithFormat:@"%@", placeDistance.text]];
    
        }
    }
    

    And call it the same way, just changing the name of the selector called to

    [disclosureButton addTarget:self action:@selector(showMoreInfo:) forControlEvents:UIControlEventTouchUpInside];
    

    And if you’re into annotations and maps, you shouldn’t use segues which are more for simple navigation.

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

Sidebar

Related Questions

I have a MapView that will contain alot of overlays. For this i've extended
I have a simple mapview that has the following viewdidload method and didupdate to
I have an app that has a mapview, and it shows 20 pins (from
I have a detail view that includes three UIButtons, each of which pushes a
I have a detail view that is pushed from a map. I am trying
I'm developing on an app that is location-based, I have a mapView set to
I have a mapView activity that has a LocationListener registered to check for a
I have a mapview with several annotations. Every annotation has a leftCalloutAccessoryView which is
I have a mapview, with the MyLocationOverlay, and other overlays. MyLocationOverlay is drawn under
HI, I have a Mapview with some marker points + a marker for current

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.