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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:00:50+00:00 2026-05-26T20:00:50+00:00

The following is my code for adding annotation into a mapview. This code is

  • 0

The following is my code for adding annotation into a mapview. This code is called in viewdidload method

-(void)displayMYMap
{
MKCoordinateRegion region = mapView.region; 
MKCoordinateSpan span; 
span.latitudeDelta=0.2; 
span.longitudeDelta=0.2; 

addAnnotation = [[[AddressAnnotation alloc] initWithCoordinate:mapCenter title:firstName SubTitle:lastName Recordid:passedRecordID]autorelease];

[mapView addAnnotation:addAnnotation];
region.span=span; 
region.center=mapCenter; 
}

I am trying to add a button to my annotation bubble. I am getting an exception while I am trying to add the button to the annotationview.

UIButton *informationButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure ];
addAnnotation.rightCalloutAccessoryView = informationButton;

This is the code I have written to add the button. I cant figure out a reason for the exception.

  • 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-05-26T20:00:51+00:00Added an answer on May 26, 2026 at 8:00 pm

    use delegate method of Annotation,

    - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
        static NSString *identifier = @"RoutePinAnnotation";
            MKPinAnnotationView* pinView = [[[MKPinAnnotationView alloc]
                                             initWithAnnotation:annotation reuseIdentifier:identifier] autorelease];
            pinView.animatesDrop=YES;
            pinView.canShowCallout=YES;
            if ([(UICCircleAnnotation *)annotation annotationType] == UICCircleAnnotationTypeOther) {
                pinView.pinColor = MKPinAnnotationColorPurple;
            } else if ([(UICCircleAnnotation *)annotation annotationType] == UICCircleAnnotationTypeContact) {
                pinView.pinColor = MKPinAnnotationColorRed;
            }
    
            UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
            [rightButton setTitle:annotation.title forState:UIControlStateNormal];
            [rightButton addTarget:self
                            action:@selector(buttonMethod:)
                  forControlEvents:UIControlEventTouchUpInside];
            pinView.rightCalloutAccessoryView = rightButton;
    
            UIImageView *profileIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"profile.png"]];
            pinView.leftCalloutAccessoryView = profileIconView;
            [profileIconView release];
    
            return pinView;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Any ideas why the following code is not adding anything into the database once
I'm adding a title to a UIToolbar (iPad) with the following code: - (void)setupToolbarItems
I have the following code adding an ActionListener to a JTextField: chatInput.addMouseListener(new java.awt.event.MouseAdapter() {
I have the following code for adding to/extracting from Zip. I'm trying to refactor
I am using the following code --- EDIT @annakata : Adding the complete code
I am getting a segmentation fault with the following code after adding structs to
I have the following code which is adding somestrings to an arraylist. It will
Stuck again. :( I have the following code crammed into a procedure invoked when
i use the following code for adding more images on scroll UIImageView* imageshow=[[UIImageView alloc]
Following code should throw exception to prevent adding duplicate collection item. ICollection<T> collection =

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.