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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:02:38+00:00 2026-05-26T01:02:38+00:00

I’m creating my own annotation callout by subclassing MKPinAnnotationView. Everything works great, except for

  • 0

I’m creating my own annotation callout by subclassing MKPinAnnotationView. Everything works great, except for when I try to add buttons inside the new callout… the buttons are never called on touch… any idea why?

Thanks in advance!

Code is below:

- (id)initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier {

    self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];

  if (self) {
    self.frame = CGRectMake(0.0f, 0.0f, 284.0f, 245.0f);
    self.backgroundColor = [UIColor clearColor];

    UIImageView *callout_bkg = [[UIImageView alloc] init];
    callout_bkg.image = [UIImage imageNamed:@"callout_bkg.png"];
    callout_bkg.frame = CGRectMake(0, 0, 240, 110);
    [self addSubview:callout_bkg];

    titleLabel_ = [[UILabel alloc] initWithFrame:CGRectMake(12.0f, 8.0f, 145.0f, 20.0f)];
    titleLabel_.textColor       = [UIColor whiteColor];
    titleLabel_.textAlignment   = UITextAlignmentLeft;
    titleLabel_.backgroundColor = [UIColor clearColor];
    titleLabel_.font = [UIFont fontWithName:@"Geogrotesque" size:12];
    [self addSubview:titleLabel_];

    descLabel_ = [[UILabel alloc] initWithFrame:CGRectMake(12.0f, 30.0f, 180.0f, 40.0f)];
    descLabel_.textColor       = [UIColor grayColor];
    descLabel_.textAlignment   = UITextAlignmentLeft;
    descLabel_.backgroundColor = [UIColor clearColor];
    descLabel_.numberOfLines = 15;
    descLabel_.font = [UIFont fontWithName:@"Geogrotesque" size:10];
    [self addSubview:descLabel_];

    communityLabel_ = [[UILabel alloc] initWithFrame:CGRectMake(125.0f, 8.0f, 60.0f, 20.0f)];
    communityLabel_.textColor       = [UIColor whiteColor];
    communityLabel_.textAlignment   = UITextAlignmentRight;
    communityLabel_.backgroundColor = [UIColor clearColor];
    communityLabel_.font = [UIFont fontWithName:@"Geogrotesque" size:10];
    [self addSubview:communityLabel_];

    typeLabel_ = [[UILabel alloc] initWithFrame:CGRectMake(12.0f, 72.0f, 50.0f, 20.0f)];
    typeLabel_.textColor       = [UIColor whiteColor];
    typeLabel_.textAlignment   = UITextAlignmentLeft;
    typeLabel_.backgroundColor = [UIColor clearColor];
    typeLabel_.font = [UIFont fontWithName:@"Geogrotesque" size:10];
    [self addSubview:typeLabel_];

    facebook_share = [[UIButton alloc] initWithFrame:CGRectMake(200, 17, 29, 27)];
    facebook_share.backgroundColor = [UIColor clearColor];
    [facebook_share setBackgroundImage:[UIImage imageNamed:@"btn_annotation_share_fb.png"] forState:UIControlStateNormal];
    [facebook_share addTarget:self action:@selector(calloutAccessoryTapped) forControlEvents:UIControlStateNormal];
    [self addSubview:facebook_share];

    twitter_share = [[UIButton alloc] initWithFrame:CGRectMake(200, 44, 29, 28)];
    twitter_share.backgroundColor = [UIColor clearColor];
    [twitter_share setBackgroundImage:[UIImage imageNamed:@"btn_annotation_share_twitter.png"] forState:UIControlStateNormal];
    [twitter_share addTarget:self action:@selector(calloutAccessoryTapped) forControlEvents:UIControlStateNormal];
    [self addSubview:twitter_share];
    }

    return self;
    }


-(void)calloutAccessoryTapped {
    NSLog(@"TEST!");
}


- (void)dealloc {
    [facebook_share release];
    [twitter_share release];

    [community_ release], community_ = nil;
    [communityLabel_ release], communityLabel_ = nil;

    [type_ release], type_ = nil;
    [typeLabel_ release], typeLabel_ = nil;

    [desc_ release], desc_ = nil;
    [descLabel_ release], descLabel_ = nil;

    [title_ release], title_ = nil;
    [titleLabel_ release], titleLabel_ = nil;

    [super dealloc];
    }

-(void)drawRect:(CGRect)rect {
    [super drawRect:rect];
    titleLabel_.text = self.type;
    descLabel_.text = self.desc;
    communityLabel_.text = self.community;
    typeLabel_.text = self.title;
    [facebook_share addTarget:self action:@selector(test:) forControlEvents:UIControlStateNormal];
    }
  • 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-26T01:02:38+00:00Added an answer on May 26, 2026 at 1:02 am

    try with :

    facebook_share = [UIButton buttonWithType:UIButtonTypeCustom];
    facebook_share.frame = yourFrame;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.