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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:58:19+00:00 2026-05-25T15:58:19+00:00

This may have been posted here somewhere but I can’t find it. I am

  • 0

This may have been posted here somewhere but I can’t find it. I am writing a simple iOS app with two UIViews. The user will first press and hold a certain area of the screen then release their touch on it then quickly touching a second view below.

The first UIView has a UILongPressGestureRecognizer attached to it and works fine. The second UIView has a UITapGestureRecognizer attached to it and also works fine. I cannot however, get either of these gesture recognizers to return anything that states that the user released their touch.

I have tried this code to no avail:

- (void)holdAction:(UILongPressGestureRecognizer *)holdRecognizer
{
    if (UIGestureRecognizerStateRecognized) {
        holdLabel.text = @"Holding Correctly. Release Touch when ready.";
        holdView.backgroundColor = [UIColor greenColor];
    } else if (UIGestureRecognizerStateCancelled){
        holdLabel.text = @"Ended";
        holdView.backgroundColor = [UIColor redColor];
}

Any suggestions would be great and especially if someone knows how to implement a call that returns the state of a user touching the device. I’ve looked over the developer docs and have come up empty.

  • 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-25T15:58:20+00:00Added an answer on May 25, 2026 at 3:58 pm

    After tinkering for a couple hours, I found a way that is working, not sure if its the best way to do it. Turns out I need to be writing it like the code below. I wasn’t calling the specific UIGestureRecognizer I was declaring in the viewDidLoad() method.

    - (void)holdAction:(UILongPressGestureRecognizer *)holdRecognizer
    {
        if (holdRecognizer.state == UIGestureRecognizerStateBegan) {
            holdLabel.text = @"Holding Correctly. Release when ready.";
            holdView.backgroundColor = [UIColor greenColor];
        } else if (holdRecognizer.state == UIGestureRecognizerStateEnded)
        {
            holdLabel.text = @"You let go!";
            holdView.backgroundColor = [UIColor redColor];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may have been hidden somewhere in the docs, but I don't remember seeing
Ok, this may have been answered, but I'm new and trying to learn, so
This question may have been asked before, but I had trouble finding an answer,
This has / may have been asked before, but, as far as I remember,
This may be have a better name than custom tab completion, but here's the
Okay this may be a simple question but I have yet to come with
This may have been answered before, and if so, point me to the answer.
This may be a stupid question but I have a code with the following
This may be a dumb question, I have tried googling but I am probably
This may be an incredibly stupid question, but I have a web application that

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.