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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:51:52+00:00 2026-06-16T02:51:52+00:00

The problem I encountered: I click on the button, but it seems that the

  • 0

Button on the calloutView

the structure of my calloutView

The problem I encountered: I click on the button, but it seems that the CalloutView received my clicking instead of the UIButton.

Some explanation first: 1.the “SYSUMyAnnoCalloutView” is a MKPinAnnotationView 2.the “SYSUMyCalloutImageView” is a UIImageView, which I init it and addSubview on the “SYSUMyAnnoCalloutView” 3. the UIButton and the UILabel was addSubviewed in the “SYSUMyCalloutImageView”

Corresponding code:
1. In the “SYSUMyAnnoCalloutView.m”

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
if (selected){
    [self.calloutImageView setFrame:CGRectMake(-75, -100, 230, 130)];

    [self animateCalloutAppearance];
    //[self.calloutImageView becomeFirstResponder];
    //[self.calloutImageView.detailButton addTarget:self.calloutImageView action:@selector(clickForDetail) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.calloutImageView];
    [self setCanShowCallout:NO];
}
else
{
    //Remove your custom view...
    [self.calloutImageView removeFromSuperview];
}
}
  1. In the “SYSUMyCalloutImageView.m”

    - (id)initWithImage:(UIImage *)image
    {
    self = [super initWithImage:image];
    if (self){
        //Label
    CGRect boundsForLabel;
    boundsForLabel.origin.x = 20;
    boundsForLabel.origin.y = 50;
    boundsForLabel.size.width = self.bounds.size.width - 100;
    boundsForLabel.size.height = 20;
    self.messageLabel = [[UILabel alloc] initWithFrame:boundsForLabel];
    self.messageLabel.backgroundColor = [UIColor clearColor];
    [self addSubview:self.messageLabel];
    //detailButton
    CGRect buttonRect;
    buttonRect.origin.x = 20;
    buttonRect.origin.y = 80;
    buttonRect.size.width = boundsForLabel.size.width-50;
    buttonRect.size.height = 30;
    self.detailButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [self.detailButton setFrame:buttonRect];
    [self.detailButton setTitle:@"Click for detail" forState:UIControlStateNormal];
    self.detailButton.userInteractionEnabled = YES;
    //[self.detailButton addTarget:self.superview action:@selector(clickForDetail) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.detailButton];
    

    }
    return self;
    }

could anybody solve my problem?? will be really appreciate that:)

  • 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-16T02:51:54+00:00Added an answer on June 16, 2026 at 2:51 am

    by default an UIImageView do not accept user interactions.

    You should try adding this line of code in the initWithImage of your SYSUMyCalloutImageView.m

    [self setUserInteractionEnabled:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I encountered a problem that I can't solve. My point is to click my
I encountered a problem. I noticed that a Property (say MyProp ) in my
I'm constructing a button that a user can click once they've opened a case
I have a DIV that slideToggles no problem. It reveals some additional options to
I am new to rails. Today I encountered a problem that I have no
I am currently working on my first website. The problem I have encountered is
Currently struggling with a problem that I've encountered variations on in the past. At
Now i encountered problem while debugging my code,that the Buttons in my application is
This is not a question, more like sharing with others a problem I encountered
I encountered a problem after having more than one texture in my engine. My

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.