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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:53:43+00:00 2026-06-13T14:53:43+00:00

UIButton * newButton = [UIButton buttonWithType:UIButtonTypeCustom]; newButton.imageObject= someImage; UIImage * imagePut = someImage.imageBlob; imagePut

  • 0
UIButton * newButton = [UIButton buttonWithType:UIButtonTypeCustom];
newButton.imageObject= someImage;
UIImage * imagePut  = someImage.imageBlob;
imagePut = [imagePut roundedCornerImage:20 borderSize:0];
[newButton setImage:imagePut forState:UIControlStateNormal];

newButton.frame= CGRectMake(column * self.distanceBetweenButton +marginBetweenButtons, row *self.distanceBetweenButton+marginBetweenButtons, self.sizeOfButtons, self.sizeOfButtons);
newButton.backgroundColor = [UIColor clearColor];
PO(@(newButton.userInteractionEnabled));
newButton.userInteractionEnabled=YES;
[newButton addTarget:self action:@selector(someImageGotPressed) forControlEvents:UIControlEventTouchUpInside];
PO(@([newButton allControlEvents]));
PO(newButton.allTargets);
[self.collectionOfButton addObject:newButton];

Simple button. The problem is someImageGotPressed is never called.

The newButton of course have userInteractionEnabled by default. However, someImageGotPressed is still not called.

The target is a UITableViewCell. I turned off the userinteractionenabled for that uiTableViewCell because I expect people to interact with the button.

I turned that back to on and it works.

However, something puzzles me. The target in addTarget can be anything right. It doesn’t even have to be a UIView or UIViewController. So why the hell the userInteractionEnabled for target matters at all?

Is this because UITableViewCell is the superview of the button and turning off userInteractionEnabled of a view will turn that off in all it’s superView or that sort of thing?

  • 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-13T14:53:44+00:00Added an answer on June 13, 2026 at 2:53 pm

    when you set the super view’s userInteractionEnabled (UITableViewCell) to NO, that will cause ignoring all the touches event to its subviews too.

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

Sidebar

Related Questions

I coded this: UIButton *buttonPrint = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonPrint setImage:[UIImage imageNamed:@stampa.png] forState:UIControlStateNormal]; buttonPrint.frame =
UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom]; [btn1 setImage:[UIImage imageNamed:@restaurant.png] forState:UIControlStateNormal]; UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
I added a new UIButton UIButton *newButton = [UIButton buttonWithType:UIButtonTypeCustom]; [newButton setFrame:CGRectMake(x, y, width,
I have a UIbutton title that I set with [[buttons objectAtIndex:selectedButtonTag] setTitle:file forState:UIControlStateNormal]; This
UIButton *btn=[[UIButton alloc] init]; and UIButton *btn=[UIButton buttonWithType:UIButtonTypeRoundedRect]; What is the difference between these
UIButton * test=[[UIButton alloc] initWithFrame:CGRectMake(30, 30, 49, 49)]; test.buttonType= UIButtonTypeCustom; -> assinging to property
For UIButton i was using first UIButtonTypeCustom now i want to change it to
I have customized UIButton with the following properties: 84x44 frame 84x44 background image 32*32
I UIButton using + buttonWithType: What I need to figure out is how to
My UIButton is set to disappear every time my UITextField is done editing, I

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.