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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:20:27+00:00 2026-05-11T20:20:27+00:00

I have a button in a Nib based view which does not behave like

  • 0

I have a button in a Nib based view which does not behave like a button (the target method is never called). I have tried to dynamically add the button but it doesnt help.

I will try to describe the app structure (as I suspect it might be causing this issue) and I may not be using the right design pattern.

  • View A is tied to Controller AC. (loaded from a nib in the root controller and pushed on to the navigation controller.)

  • View A has multiple subviews embedded. Lets call one of those A’.

  • In the AC::viewDidLoad method:

    I load 3 viewControllers a,b,c into member variables of AC.

Depending on the app settings I add the view of one of these controllers as the subview of A’

Essentially in the AC::viewDidLoad method:

[A' addSubView:(a.view)];

Now a.view has a button (which is tagged).I search for that tag. and Add a target Method to it dynamically. At this point the a.view is displayed as subview of A’ and the button is also visible. Great.

But touch interaction does not happen or the touch action is consumed by someone other than my method.

I have tried a lot of variations but the execution never reaches my method. I even tried adding the target to all touchUpEvents. nothing. I checked the control values in the enabled events and that is correct. That button is simply disabled somehow.
I wrote a simple app with one view and did the same, it worked. So I am thinking it is something to do with the way I am putting multiple pieces together.

Any Ideas?

I wish I had something like Spy++ where I could see the message Queue and see who was consuming this messages instead of my app or even look at the class object. I am a newbie to this platform. My earlier struggle with this is on this thread.

  • 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-11T20:20:27+00:00Added an answer on May 11, 2026 at 8:20 pm

    Resolved it finally!!! and learnt something in return. Did cost me a few days to figure this out.

    The reason my UIButton object was not working was because I found that in case of a UIIMageView object:

    “initWithImage: This method adjusts the frame of the receiver to match the size of the specified image. It also disables user interactions for the image view by default.”

    AND my UIButton had been assigned as a subview of a UIImageView control in the nib file !!!

    There was no errors / warnings. It just gets disabled quietly.

    Solution: Created a container UIView object which now contains the UIImageView AND the button so that the button appears as overlayed on the Image but it is actually a sibling of the image and a subview of the dummy container UIView.

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

Sidebar

Ask A Question

Stats

  • Questions 362k
  • Answers 362k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Calling the method directly is more readable. performSelector: should be… May 14, 2026 at 3:12 pm
  • Editorial Team
    Editorial Team added an answer Try this: class CommentsController < ApplicationController before_filter :post_check def record_post_time… May 14, 2026 at 3:12 pm
  • Editorial Team
    Editorial Team added an answer Use an Expression, e.g. Write(x =>semiNice.y, 0) This technique is… May 14, 2026 at 3:12 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.