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

  • Home
  • SEARCH
  • 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 8642763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:51:39+00:00 2026-06-12T11:51:39+00:00

I have an issue where CalloutAccessoryControlTapped never gets called, when the user clicks on

  • 0

I have an issue where CalloutAccessoryControlTapped never gets called, when the user clicks on a callout. Has this been removed or changed in Apple Maps?

In iOS 5, my call out looked like this:

(Image) Restaurant Name / Address >

When I click the call out, I would get a dialog. In iOS6, my call out looks like this:

RestaurantName / Address

Why has my call out changed in Apple Maps?

Here is what it looks like in iOS 6:

Has Apple Maps removed the CalloutAccessControlTapped feature?

Here is my code:

using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.MapKit;
using MonoTouch.CoreLocation;
using System.Linq;
using MenuFinderAN.BusinessLogic.MenuFinderServiceReference;
using System.Collections.Generic;

namespace MenuFinderMT
{
public partial class MapUniversalController : UIViewController
{
    static bool UserInterfaceIdiomIsPhone {
        get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
    }

    public AppDelegate AppDelegate { get; set; }

    public List<IGrouping<string, RestaurantLocation>> LocationList { get; set; }

    public MapUniversalController (List<IGrouping<string, RestaurantLocation>> locationList)
        : base (UserInterfaceIdiomIsPhone ? "MapUniversalController_iPhone" : "MapUniversalController_iPad", null)
    {
        LocationList = locationList;
    }

    public override void DidReceiveMemoryWarning ()
    {
        // Releases the view if it doesn't have a superview.
        base.DidReceiveMemoryWarning ();

        // Release any cached data, images, etc that aren't in use.
    }

    MKMapView mapView;

    public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();
        AppDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
        Title = "Locations";

        mapView = new MKMapView (View.Bounds);  
        mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;       
        //mapView.MapType = MKMapType.Standard; // this is the default
        //mapView.MapType = MKMapType.Satellite;
        //mapView.MapType = MKMapType.Hybrid;
        View.AddSubview (mapView);

        List<RestaurantLocation> locations = LocationList.SelectMany (x => x).ToList ();

        // create our location and zoom 

        double lat = 0;
        double lng = 0;

        foreach (RestaurantLocation loc in locations) {
            if (loc.Latitude > 0 && lat == 0) {
                lat = loc.Latitude;
                lng = loc.Longitude;
            }

            // add a basic annotation
            var annotation = new BasicMapAnnotation (new CLLocationCoordinate2D (loc.Latitude, loc.Longitude), loc.Name, loc.Address + ", " + loc.City);
            mapView.AddAnnotation (annotation);
        }

        CLLocationCoordinate2D coords = new CLLocationCoordinate2D (lat, lng); 

        MKCoordinateSpan span = new MKCoordinateSpan (MilesToLatitudeDegrees (20), MilesToLongitudeDegrees (20, coords.Latitude));

        // set the coords and zoom on the map
        mapView.Region = new MKCoordinateRegion (coords, span);


        // assign the delegate, which handles annotation layout and clicking
        mapView.Delegate = new MapDelegate (this, locations);


    }

    /// <summary>
    /// Converts miles to latitude degrees
    /// </summary>
    public double MilesToLatitudeDegrees (double miles)
    {
        double earthRadius = 3960.0;
        double radiansToDegrees = 180.0 / Math.PI;
        return (miles / earthRadius) * radiansToDegrees;
    }

    /// <summary>
    /// Converts miles to longitudinal degrees at a specified latitude
    /// </summary>
    public double MilesToLongitudeDegrees (double miles, double atLatitude)
    {
        double earthRadius = 3960.0;
        double degreesToRadians = Math.PI / 180.0;
        double radiansToDegrees = 180.0 / Math.PI;

        // derive the earth's radius at that point in latitude
        double radiusAtLatitude = earthRadius * Math.Cos (atLatitude * degreesToRadians);
        return (miles / radiusAtLatitude) * radiansToDegrees;
    }

    public override void ViewDidUnload ()
    {
        base.ViewDidUnload ();

        // Clear any references to subviews of the main view in order to
        // allow the Garbage Collector to collect them sooner.
        //
        // e.g. myOutlet.Dispose (); myOutlet = null;

        ReleaseDesignerOutlets ();
    }
}

// The map delegate is much like the table delegate.
class MapDelegate : MKMapViewDelegate
{
    protected string annotationIdentifier = "BasicAnnotation";
    MapUniversalController mapUniversalController;
    List<RestaurantLocation> locations;

    public MapDelegate (MapUniversalController mapUniversalController, List<RestaurantLocation> locations)
    {
        this.mapUniversalController = mapUniversalController;
        this.locations = locations;
    }

    /// <summary>
    /// This is very much like the GetCell method on the table delegate
    /// </summary>
    public override MKAnnotationView GetViewForAnnotation (MKMapView mapView, NSObject annotation)
    {
        // try and dequeue the annotation view
        MKAnnotationView annotationView = mapView.DequeueReusableAnnotation (annotationIdentifier);

        // if we couldn't dequeue one, create a new one
        if (annotationView == null)
            annotationView = new MKPinAnnotationView (annotation, annotationIdentifier);
        else // if we did dequeue one for reuse, assign the annotation to it
            annotationView.Annotation = annotation;

        // configure our annotation view properties
        annotationView.CanShowCallout = true;
        (annotationView as MKPinAnnotationView).AnimatesDrop = true;
        (annotationView as MKPinAnnotationView).PinColor = MKPinAnnotationColor.Green;
        annotationView.Selected = true;

        // you can add an accessory view, in this case, we'll add a button on the right, and an image on the left
        annotationView.RightCalloutAccessoryView = UIButton.FromType (UIButtonType.DetailDisclosure);

        annotationView.LeftCalloutAccessoryView = new UIImageView (UIImage.FromBundle ("Images/Icons/MenuFinder_Logo-29x29.png"));

        return annotationView;
    }

    public override void CalloutAccessoryControlTapped (MKMapView mapView, MKAnnotationView view, UIControl control)
    {
        var annotation = view.Annotation;
        var coords = (annotation as MKAnnotation).Coordinate;
        RestaurantLocation restaurantLocation = locations.Where (a => a.Latitude == coords.Latitude && a.Longitude == coords.Longitude).FirstOrDefault ();
        UIAlertView alertt = new UIAlertView ("Directions?", "Would you like directions?", null, "Yes", null);
        alertt.AddButton ("No");
        alertt.Clicked += delegate(object sender, UIButtonEventArgs e) {
            if (e.ButtonIndex == 0) {
                double slat = (double)mapUniversalController.AppDelegate.Latitude;
                double slng = (double)mapUniversalController.AppDelegate.Longitude;
                string saddr = slat.ToString () + "," + slng.ToString ();
                string daddr = coords.Latitude.ToString () + "," + coords.Longitude.ToString ();
                NSUrl url = new NSUrl ("http://maps.google.com/maps?saddr=" + saddr + "&daddr=" + daddr);
                UIApplication.SharedApplication.OpenUrl (url);
            } else {
                mapUniversalController.AppDelegate.CurrentRestaurantLocation = restaurantLocation;
                // Pass the selected object to the new view controller.
                mapUniversalController.NavigationController.PushViewController (new RestaurantDetailsUniversalController (), true);
            }
        };
        alertt.Show ();


    }

    // as an optimization, you should override this method to add or remove annotations as the 
    // map zooms in or out.
    public override void RegionChanged (MKMapView mapView, bool animated)
    {
    }
}

class BasicMapAnnotation : MKAnnotation
{
    /// <summary>
    /// The location of the annotation
    /// </summary>
    public override CLLocationCoordinate2D Coordinate { get; set; }

    protected string title;
    protected string subtitle;

    /// <summary>
    /// The title text
    /// </summary>
    public override string Title
    { get { return title; } }


    /// <summary>
    /// The subtitle text
    /// </summary>
    public override string Subtitle
    { get { return subtitle; } }

    public BasicMapAnnotation (CLLocationCoordinate2D coordinate, string title, string subTitle)
        : base()
    {
        this.Coordinate = coordinate;
        this.title = title;
        this.subtitle = subTitle;
    }
}

}

  • 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-12T11:51:41+00:00Added an answer on June 12, 2026 at 11:51 am

    The delegate handling behavior has changed slightly with iOS 6. Make sure you assign the MapDelegate before adding any annotations.

    Edit: see rule #2: Set the Delegate or all events before setting properties or using the instance (blog has details why it’s important, not just in MonoTouch)

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

Sidebar

Related Questions

I have issue, after checkout on checkout/onepage/success get a user info using order id,
I have issue with url rewrite. I have a site example.com that has a
I have some pins that the user can add. In the callout there is
I have issue with: <form:checkboxes path=roles cssClass=checkbox items=${roleSelections} /> If previous line is used
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
We are new to ROR, We have issue in creating Login/Logout process in ROR
Share your ideas please! I have issue to check the folder and convert a
Have an issue with marshall and unmarshall readers and writers. So here it is.
I have an issue with jquery and history.back(): I got a link: <a href=#
I have an issue of alphabetically sorting the contacts picked from the address book

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.