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

  • Home
  • SEARCH
  • 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 8331285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:22:17+00:00 2026-06-09T02:22:17+00:00

I have a button and an image. When the button is pressed and held

  • 0

I have a button and an image. When the button is pressed and held I want the image to movie across the screen quickly. Right now after I press and hold it just moves after I let go. I need it to start moving after a certain amount of time and stop when I let go.
here is what I have:

- (IBAction)buttonDown:(id)sender
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];

    x = x + 100;
}
  • 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-09T02:22:20+00:00Added an answer on June 9, 2026 at 2:22 am

    With below code, you have to push 3 seconds to move _imageView, and then the image begins moving, and when you release the button, the image stops.

    ss

    - (IBAction)pushToMove:(id)sender {
        [self performSelector:@selector(move) withObject:nil afterDelay:3.0];
    }
    
    - (void)move
    {
        _nt = [NSTimer scheduledTimerWithTimeInterval:0.1
                                                       target:self
                                                     selector:@selector(goRight)
                                                     userInfo:nil
                                                      repeats:YES];
    }
    
    - (void)goRight
    {
        _imageView.frame = CGRectMake(_imageView.frame.origin.x + 10, _imageView.frame.origin.y,
                                      _imageView.frame.size.width, _imageView.frame.size.height);
    }
    
    - (IBAction)stop
    {
        [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(move) object:nil];
        [_nt invalidate];
    }
    

    I put this sample project to GitHub. You can download and just run it.

    https://github.com/weed/p120804_ImageMoveDuringPushButton

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

Sidebar

Related Questions

I have a image button and i want that image button when pressed it
i have this button xml, when it be will pressed, the pressed image(b) would
I have a button that cause an image to display the image full screen
I have a button inside each cell. When it's pressed, the image is changed
I have a button with an image that links to another page when pressed.
Ok, I have a button that, when pressed, should animate/play a png image sequence.
Is there any way I can get hold of which button I have pressed?
I have lots of image buttons. User can press any of those button and
I have a button and image inside it in my silverlight user control. When
I have a image button thats acts as a form submit button: <a href=#

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.