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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:24:40+00:00 2026-06-12T15:24:40+00:00

I have this following function implemented in my app There are no errors at

  • 0

I have this following function implemented in my app

There are no errors at compile time. Yet I cannot see the right accessory button on my map annotations in the simulator. I see the annotation, its just that there is no button on it.
Is there a trick to this that Im missing?

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id 
 <MKAnnotation>)annotation
 {
    static NSString *identifier = @"Vendor";

    //Set upt the right accessory button
    UIButton *myDetailAccessoryButton = [UIButton 
    buttonWithType:UIButtonTypeDetailDisclosure];
    myDetailAccessoryButton.frame = CGRectMake(0, 0, 23, 23);
    myDetailAccessoryButton.contentVerticalAlignment = 
    UIControlContentVerticalAlignmentCenter;
    myDetailAccessoryButton.contentHorizontalAlignment = 
    UIControlContentHorizontalAlignmentCenter;

    [myDetailAccessoryButton addTarget:self
                            action:nil
                  forControlEvents:UIControlEventTouchUpInside];

     if ([annotation isKindOfClass:[Vendor class]])
     {

       MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [self.mapView

       dequeueReusableAnnotationViewWithIdentifier:identifier];
       if (annotationView == nil)
      {
        annotationView = [[MKPinAnnotationView alloc]
                          initWithAnnotation:annotation
                          reuseIdentifier:identifier];
        annotationView.rightCalloutAccessoryView = myDetailAccessoryButton;
        annotationView.enabled = YES;
        annotationView.canShowCallout = YES;
        annotationView.calloutOffset = CGPointMake(-5, 5);

    }
    else
    {
        annotationView.annotation = annotation;
    }

    return annotationView;
     }

     return nil;
   }

EDIT
This code worked but the above one doesn’t.

Why is that?

   if ([annotation isMemberOfClass:[MKUserLocation class]])
    return nil;

 MKPinAnnotationView *annView=[[MKPinAnnotationView alloc]
                               initWithAnnotation:annotation
                               reuseIdentifier:@"currentloc"];


   UIButton *myDetailButton = [UIButton 
   buttonWithType:UIButtonTypeDetailDisclosure];
    myDetailButton.frame = CGRectMake(0, 0, 23, 23);
    myDetailButton.contentVerticalAlignment = 
    UIControlContentVerticalAlignmentCenter;
    myDetailButton.contentHorizontalAlignment = 
   UIControlContentHorizontalAlignmentCenter;

[myDetailButton addTarget:self
                   action:nil
         forControlEvents:UIControlEventTouchUpInside];

    annView.rightCalloutAccessoryView = myDetailButton;

   annView.animatesDrop=NO;
   annView.canShowCallout = YES;
   annView.calloutOffset = CGPointMake(-5, 5);
   return annView;
  • 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-12T15:24:42+00:00Added an answer on June 12, 2026 at 3:24 pm

    Are you sure you’re adding annotations of type Vendor?

    Because the first code block only sets the rightCalloutAccessoryView for annotations of type Vendor. For any other type, it returns nil resulting in a generic callout (no buttons).

    The second code block sets the rightCalloutAccessoryView for any annotation type except MKUserLocation.

    By the way, you’ve set the button action to nil which means nothing will happen when it’s tapped.

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

Sidebar

Related Questions

I have the following function: this.alphaArray = function() { var alpha = this.alphStr, ,
I have the following function: if ($(this).find('#sel').length == 0) { var before = $(this).text();
I have this timer function, it gives me following exception. Collection was modified; enumeration
I have the following function. $(function() { $(.sectionHeader:gt(0)).click(function() { $(this).next(.fieldset).slideToggle(fast); }); $(img[alt='minimize']).click(function(e) { $(this).closest(table).next(.fieldset).slideUp(fast);
I have a following design function crudDataTable() { this.addEditFormContainerSelector = ''; this.paginationType = full_numbers;
I have the following code: function Person(){ this.age = 30; } function Stats(){ this.age
I have the following simple function: private void EnableDisable941ScheduleBButton() { if (this._uosDepositorFrequency.Value != null)
I have the following code: function toggleChecked(status) { $(.checkbox).each( function() { $(this).attr(checked,status); }) }
I have the following javascript function: <script type=text/javascript> function quickCardRegister_OnCompleteSave() { publishContent('This is a
I have the following object defined function BusinessUnit(id, name, code) { this.id = ko.observable(id);

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.