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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:32:39+00:00 2026-05-26T16:32:39+00:00

Everybody.. How to set animation on button click ? I have two buttons, both

  • 0

Everybody..
How to set animation on button click ?

I have two buttons, both have different frame..

First   CGRectMake (10 , 10 , 100 , 80 ); It has Black Image,
Second  CGRectMake (200, 10 , 210 , 80 ); It has White Image,

When I click on First button of those, It should be animate to move from one frame to another frame..

Only seen like first’s button Black Image move to second button location.. Like Image changes of Buttons..

After clicked button frame does not change… Should be remain as First and Second..

I have tried but not got the exact

buttonFirst.frame = buttonSecond.frame;
buttonFirst.center = buttonSecond.center; 
buttonFirst.transform = CGAffineTransformMakeTranslation( buttonSecond.frame.origin.x - buttonFirst.frame.origin.x , buttonSecond.frame.origin.y - buttonFirst.frame.origin.y);

How to animate this ?

Editting :

I need to move one checkers from one CGRect to Another CGRect.. So, It want to display like moving checkers, But i dont want to change CGRect, Only button images looks like that…

Please tell me..
Thanks…

  • 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-26T16:32:40+00:00Added an answer on May 26, 2026 at 4:32 pm

    Finally i got the answer…

    I have set two button in two separate view. after set one timer, and move first button image to another button’s position..
    Here is a sample code for that..

    Step 1 : Set view with Timer

    UIView *oldView = [[UIView alloc] init];  
                        oldView = [viewArray objectAtIndex:selectedIndex];
                        UIView *newView = [[UIView alloc] init];
                        newView = [viewArray objectAtIndex:[sender tag]]; 
                        oldRect = [oldView frame];                    
                        newRect = [newView frame];
                        movingTimer = [[NSTimer alloc] init];
                        movingTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(movingCheckers:) userInfo:nil repeats:YES];
    
                        imageViewMove = [[UIImageView alloc] init];
                        [imageViewMove setFrame:oldRect];
                        [imageViewMove setImage:[UIImage imageNamed:blackManName]];
    
                        [self.view bringSubviewToFront:imageViewMove];
                        [self.view addSubview:imageViewMove];
    

    Step 2 : Moving Image to second position

    CGPoint aPoint = CGPointMake(newRect.origin.x - oldRect.origin.x, oldRect.origin.y - newRect.origin.y);                    
    imageViewMove.frame = CGRectMake(imageViewMove.frame.origin.x + (aPoint.x / 6) , imageViewMove.frame.origin.y - (aPoint.y / 6), imageViewMove.frame.size.width, imageViewMove.frame.size.height);
    if (imageViewMove.frame.origin.x >= newRect.origin.x)
    {
                    [selectButton setBackgroundImage:nil forState:UIControlStateNormal]; 
                    [moveButton setBackgroundImage:imageViewMove.image forState:UIControlStateNormal];
                    [imageViewMove removeFromSuperview];
                    [movingTimer invalidate];
    }
    

    Now its work…..

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

Sidebar

Related Questions

Hey everybody, this is what I have going on. I have two text files.
Everybody, I need to set one image on UIAlertView.. I have attached my UIAlertview
Suppose I have two instances of the same class. The class has a pointer
Hey everybody, I'm very confused about how to use two different Cell Types in
How should one have several different controller' actions set a common instance variable for
Everybody.. I have create one universal application.. My app worked fine to only two
everybody; I have this problem in asp.net, I have a page where I insert
Greetings everybody. I have seen examples of such operations for so many times that
It seems that everybody knows you're supposed to have a clear distinction between the
I have two arrays, say A and B with |A|=8 and |B|=4. I want

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.