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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:12:17+00:00 2026-06-15T08:12:17+00:00

By tapping simple UIButton on main UIView, additional View (subview) appears in the center

  • 0

By tapping simple UIButton on main UIView, additional View (subview) appears in the center of screen (subview created programmatically). On that subview I have UIButton that launches MPMoviePlayer (this code is inside method that creates subview):

 // Create play button

UIButton *playButton = [UIButton buttonWithType:UIButtonTypeCustom];
[playButton addTarget:self
               action:@selector(wtf)
     forControlEvents:UIControlEventTouchUpInside];

[playButton setTitle:@"" forState:UIControlEventTouchUpInside];
[playButton setImage:[UIImage imageNamed:[self.playButtons objectAtIndex:[sender tag] - 1]] forState:UIControlStateNormal];
playButton.frame = playButtonRect;
playButton.userInteractionEnabled = YES;

This button added as subview to this view inside the same method:

[self.infoView addSubview:playButton];

In iOS Simulator 6.0 and real device with iOS 6.0 everything works fine, in Simulator iOS 5.0 and device with 5.0 I have a very strange behavior: button start to work only when I made drag by the area of this button, when I just clicked on button – it called method what called when user taps anywhere in the screen, like my button doesn’t appear on screen (but visually it does). My goal is to make this app for 5.x, so I try to find answer on this strange issue.

Any advices are welcome!

  • 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-15T08:12:19+00:00Added an answer on June 15, 2026 at 8:12 am

    Are you adding a UITapGestureRecognizer to infoView or any of it subviews?

    If that is the case, your gesture recognizer is inhibiting the UIButton action. You could use the solution provided by Kevin Ballard or cdasher on this post

    You just need to set the view that has the UITapGestureRecognizer as the delegate of that Gesture Recognizer (UIGestureRecognizerDelegate). Then you can add the following code:

    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
    {
        return ! ([touch.view isKindOfClass:[UIControl class]]);
    }
    

    And your Tap Gesture Recognizer should look like this:

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureAction)];
    tap.delegate = self;
    [self.view addGestureRecognizer:tap];
    

    Hope this helps!

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

Sidebar

Related Questions

I have a simple (view-based) application. I want on tapping on custom UIView my
I have created a custom UIView that I would like to use on multiple
I have a screen that shows details of a Newspaper (model) instance. The ViewController
I have a simple - trivial - UIView parent/child hierarchy. One parent (UIView). One
I am tapping into a service that provides zip codes tax information - there
i am facing the problem tapping on the table view my code was not
I have a simple TableView containing several cells. Normally, I switch to selected cell
I have to solve how to enter the Menu only by tapping the Alt
i have read articles that say: using the prototype will be fastest since functions
I have a table with several text fields in it. Tapping on any of

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.