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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:22:09+00:00 2026-06-15T23:22:09+00:00

I had a project which contains lots of UIButton, using xcode 4.5 and storyboard

  • 0

I had a project which contains lots of UIButton, using xcode 4.5 and storyboard and ARC. after testing in ios6, everything goes fine. But in ios5, UIButton touch up inside event not working, the action not called. I tried to use touch down and it works. However, I have a lot of UIButton, I cannot change that one by one. what’s more, the touch down event does give a good experience.

I used code below in many of my view controllers:
in viewDidLoad:

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self
                                                                      action:@selector(dismissKeyboard)];

[self.view addGestureRecognizer:tap];

-(void)dismissKeyboard {
       [aTextField resignFirstResponder];
}

this might be the reason. I will check it out later. But it works in ios6.
Do you know what’s wrong ? Thanks very much!

  • 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-15T23:22:10+00:00Added an answer on June 15, 2026 at 11:22 pm

    I had the same problem to you.
    That’s because the touch event in iOS5 is prevented when the gestureRecognizer you registered captures the event.

    There are two solutions.

    One:

    1) Add a new view inside your view. It should have the same level to the buttons. The priority of the buttons should be higher than the new view.

    2) change the call of ‘addGestureRecognizer’ to the new view.

    [self.newView addGestureRecognizer:tap];
    

    Two:

    1) Implement the code below. You should return NO when the point is in the buttons.

    - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
    {
        CGPoint point = [gestureRecognizer locationInView:self.view];
    
        NSLog(@"x = %.0f, y = %.0f", point.x, point.y);
        if (CGRectContainsPoint(self.testBtn.layer.frame, point))
            return NO;
    
        return YES;
    }
    

    ps.
    you should import QuartzCore.h to access layer’s attributes.

    #import <QuartzCore/QuartzCore.h>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had one Git repository (A) which contains the development of a project until
We have a project which had to be radically descoped in order to ship
In NetBeans 6.7.1, I had a Java project in which I renamed some classes.
My project had audit module, which includes each and every action of the user
I had a large Silverlight project with an unwieldy web.config, which used transforms against
I had a project and everything was working and then for some reasons I
I'm working on a .NET C# project on which I had to use NHibernate
I have TableLayout in my project which contains 6 TableRow layouts. Each TableRow layout
I have a class library which I maintain in it's own project/solution. It contains
I have a new MVC3 project with one Controller called PublicController.cs which contains 4

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.