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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:58:23+00:00 2026-06-06T02:58:23+00:00

Lets say I wan’t to add 1 to an integer. This will only be

  • 0

Lets say I wan’t to add 1 to an integer. This will only be done when I push down on a UIButton and then release my finger on another UIButton. A drag combo. Whats the easiest way I can make an IBAction occur out of a combo? This could be done with touch coordinates or maybe just UIButtons and IBActions.

How do I create a 2-button combo with IBActions

  • 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-06T02:58:24+00:00Added an answer on June 6, 2026 at 2:58 am

    Try implementing the button you wish to touch down on as a “Touch Down”, “Touch Up Inside”, and “Touch Up Outside” button.

    UIButtons can respond to many differing types of events
    Touch Cancel
    Touch Down
    Touch Down Repeat
    Touch Drag Enter
    Touch Drag Exit
    Touch Drag Inside
    Touch Drag Outside
    Touch Up Inside
    Touch Up Outside

    You can implement different action code for each of these for each button for best control of whatever you wish. The simplistic case only uses the 2 I mentioned above.

    THIS CODE HAS BEEN TESTED AND DOES WORK

    In your ViewController header file (here was mine):

    @interface ViewController : UIViewController{
        IBOutlet UIButton * upButton;    // count up when finger released button
        IBOutlet UIButton * downButton;
        IBOutlet UILable * score;
        BOOL isButtonDown;
        unsigned int youCounter;
    }
    
    -(IBAction)downButtonDown:(id)sender;
    -(IBAction)downButtonUpInside:(id)sender;
    -(IBAction)downButtonDragOutside:(id)sender event:(UIEvent *)event;
    -(IBAction)downButtonUpOutside:(id)sender event:(UIEvent *)event;
    
    @end
    

    In your .xib, connect the down button (the one you wish to be your original finger pressed button) to the proper actions above.

    In your ViewController.m file

    -(void)viewDidLoad{
        [super viewDidLoad];
    
        isButtonDown = NO;
        youCounter   = 0;
    }
    
    -(IBAction)downButtonDown:(id)sender{
        isButtonDown = YES;
    }
    
    -(IBAction)downButtonUpInside:(id)sender{
        isButtonDown = NO;
    }
    
    -(IBAction)downButtonDragOutside:(id)sender event:(UIEvent *)event{
        NSArray theTouches = [[event allTouches] allObjects];
    
        [downButton setHighlighted:YES];
    
        if(YES == [upButton pointInside:[[theTouches objectAtIndex:0] locationInView:upButton] withEvent:event]){
            [upButton setHighlighted:YES];
        }else{
            [upButton setHighlighted:NO];
        }
    }
    
    -(IBAction)downButtonUpOutside:(id)sender event:(UIEvent *)event{
        if(YES == [upButton pointInside:[[theTouches objectAtIndex:0] locationInView:upButton] withEvent:event]){
            youCounter++;
            score.text = [NSString stringWithFormat:@"Score = %d", youCounter];
        }
    
        [downButton setHighlighted:NO];
        [upButton setHighlighted:NO];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have this code: <?php class hello { var $greeting = hello;
Lets say I have hierarchy like this (This is just a test program. Please
Lets say I have one table called REVIEWS This table has Reviews that customers
Lets say you have strings of this format. January 11th, 111 November 1st, 1101
Lets say that I have this code $(document).ready(function() { $(#changeText).click(function() { $(#textBox).html(My<br><br><br>text<br><br><br>is<br><br><br>changed!); }); });
Lets say I have a div like this: <div id=test class=sourcecode> Some String </div>
Lets say I have an enumerable source, that looks like this: IEnumerable<string> source =
Hello Lets say I have a console application, that looks like this class Program
Lets say I have a p tag like this: <div id = example> <p
Lets say I have two tables in Postgres: Name: table_rad Column Type id integer

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.