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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:06:22+00:00 2026-05-23T04:06:22+00:00

I have a new gesture, (touch, drag onto other, release) which I would like

  • 0

I have a new gesture, (touch, drag onto other, release) which I would like to have behave the same as touchUpInside or touchDown or any of that list that pops up when you tie in IBActions in interface builder. (I.e. I want my custom ones on that list so I can tie them to IBActions)

Is there a way to do this or do I need to programmatically tie things together?

Update: The Next Best Thing

Here’s a very stripped down version of what I did that de-coupled my object from any other particular class, in case anyone else tries to accomplish this:

@interface PopupButton : UIView {

}

//These are the replacement "IBAction" type connections.
@property (nonatomic) SEL tapAction;
@property (nonatomic, assign) id tapTarget;

@property (nonatomic) SEL dragAction;
@property (nonatomic, assign) id dragTarget;

@end

@implementation PopupButton

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    //Your custom code to detect the event
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    //Your custom code to detect the event
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    //Here we'll say I detected the event I called "drag".
    if (!(self.dragTarget && self.dragAction)) {
        NSLog(@"No target for drag.");
        abort();
    } else {
        [self.dragTarget performSelector:self.dragAction];
    }

    //And here I detected the event "tap".
    if (!(self.tapTarget && self.tapAction)) {
        NSLog(@"No target for single tap.");
        abort();
    } else {
        [self.tapTarget performSelector:self.tapAction];
    }
}

-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
    //Your custom code to detect the event
}

@end

Now to set this up, in the view controller I wanted to tie these actions I put this instead:

- (void)viewDidLoad
{
    [equalsPopupButton setTapTarget:self];
    [equalsPopupButton setTapAction:@selector(equalsPress)];
    [equalsPopupButton setDragTarget:self];
    [equalsPopupButton setDragAction:@selector(isNamingResult)];
}

Not as elegant obviously as option+drag, but it gets the job done without making my code all rigid and attached. Hope this helps someone.

  • 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-23T04:06:23+00:00Added an answer on May 23, 2026 at 4:06 am

    It is not possible to tie the functions this way. You should use an auxiliary function in code and call it from the IBaction function and the gesture recognizer function.

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

Sidebar

Related Questions

In my app I have added the new Gesture Recognizers that are available in
I have a list of Gesture classes in my application: List<Gesture> gestures = new
I have a TextView which I've assigned both an onTouchListener and an onClickListener: myTextView.setOnTouchListener(new
I have a pinch gesture recognizer attached to an imageview from which I use
I am new to Android development. I would like to use the viewflipper to
New to iPhone dev. I have a view which contains a UIScrollView which contains
I have make application in which swipe Gesture detection is used for left to
I would like to implement a swipe gesture to delete rows in a ListView
i have new webcam. The software of the webcam can give out the webcam
I have new problem. My code: .method public static void Main() cil managed {

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.