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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:10:20+00:00 2026-05-14T00:10:20+00:00

I am just getting stated with iPhone development and can’t seem to find the

  • 0

I am just getting stated with iPhone development and can’t seem to find the answer I am looking for what I want to do.

It seems like I should be able to programmatically create a UIImageView and then set up an event handler for it’s touch functions.

in c# i would have something that looks like

Button b = new Button();
b.Click+= my handler code

right now I have this

CGRect myImageRect = CGRectMake(0.0f, 0.0f, 141.0f, 151.0f);
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];

myImage.userInteractionEnabled = YES;
[myImage setImage:[UIImage imageNamed:@"myImage.png"]];
myImage.opaque = YES; // explicitly opaque for performance
[self.view addSubview:myImage];
[myImage release];

What do I need to do to override the touch events?

thanks

  • 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-14T00:10:21+00:00Added an answer on May 14, 2026 at 12:10 am

    While it is not the complete answer to your question, i think the following solution might be better then doing the “invisible-button-workaround”..
    simply subclass from UIImageView and override the following method:

    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    {
    
     //your UIImageView has been touched :)
    
     //event -> "A UIEvent object representing the event to which the touches belong."
    
     //touches -> "A set of UITouch instances in the event represented by event that    represent the touches in the UITouchPhaseEnded phase."
    
    }
    

    hope this helps…

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

Sidebar

Related Questions

I am just getting started with MVC, and it seems like it will be
I'm just getting started with Mac and iPhone development, and naturally my first step
I am just getting started with iphone development I have a Tabbed application and
I just started getting into iPhone development. I have been mish-mashing tutorials and material
HI all, I'm just getting started with developing for Android. I'm looking to port
Just getting started on iPhone dev today and have run through Apple's HelloWorld tutorial:
I'm just getting started with Android app development on a Mac, and I keep
I'm just getting started with mobile development, and after considerable searching I'm still confused
Just getting started with iphone and ipad apps. Lots of reading, lots of tinkering,
I am just getting started on Windows phone 7 development and am stuck at

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.