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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:23:55+00:00 2026-06-17T12:23:55+00:00

I have three UIButton objects visually stacked one on top of another. When a

  • 0

I have three UIButton objects visually stacked one on top of another. When a user taps on a button the buttons below should move down a certain distance. I am using the following animation block:

// Assuming button 1 was clicked...
[UIView animateWithDuration:0.25f
                      delay:0.0f
                    options:UIViewAnimationOptionCurveLinear
                 animations:^(void) {
                   self.button2.frame = CGRectOffset(self.button2.frame, 0.0f, 20.0f);
                   self.button3.frame = CGRectOffset(self.button3.frame, 0.0f, 20.0f);
                 }
                 completion:^(BOOL finished) { NSLog(@"Finished"); }];

If I increase the animation duration, e.g. from 0.25 to 0.75, the buttons do not remain together but they begin to move in different time intervals. I have tried with Core Animation methods, by grouping animations and other stuff, but haven’t found any solution yet.

Do you have any ideas? Right now I’m keeping the duration in 0.25 until I come up with something.

  • 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-17T12:23:56+00:00Added an answer on June 17, 2026 at 12:23 pm

    One solution is to set both button2 and button3 as a subview in another UIView and animate the view instead of each of the buttons separately. Whether this is a good approach depends on what you are trying to accomplish with the stacked button.

    EDIT:

    Since my experience is that animations within a block are in sync, I implemented the code as show below. I tried numerous values for the animation duration (0.15, 0.25, 0.75, 1.25) and button2 and button3 are moving in sync (and since button2 is on top of button3, I can’t actually see button3 at all, until I tap on button2, which causes button3 to move from underneath button 3).

    - (IBAction)button1Tapped:(id)sender {
        NSLog(@"button1Tapped...");
    
        [UIView animateWithDuration:0.75f
                              delay:0.0f
                            options:UIViewAnimationOptionCurveEaseOut
                         animations:^(void) {
                             self.button2.frame = CGRectOffset(self.button2.frame, 0.0f, 20.0f);
                             self.button3.frame = CGRectOffset(self.button3.frame, 0.0f, 20.0f);
                         }
                         completion:^(BOOL finished) { NSLog(@"Finished"); }];
    }
    
    - (IBAction)button2Tapped:(id)sender {
        NSLog(@"button2Tapped...");
    
        [UIView animateWithDuration:0.75f
                              delay:0.0f
                            options:UIViewAnimationOptionCurveEaseOut
                         animations:^(void) {
                             self.button3.frame = CGRectOffset(self.button3.frame, 0.0f, 20.0f);
                         }
                         completion:^(BOOL finished) { NSLog(@"Finished"); }];
    }
    
    - (IBAction)button3Tapped:(id)sender {
        NSLog(@"button3Tapped...");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have three classes User, Group and Field. Many to many relationship on User /
I have three files: lib.c lib.h => They should be built as a .so
I have multiple objects, each with a series of attributes. I'd like the user
Q1. I have three controls: UILabel , UIButton , and UILabel in a single
The context: I have three views. One Introductory view, an Upload view and the
I have a UISegmentedControl button with three segments. In ViewController.m this is working just
I have a button class named BFToggleButton , derived from UIButton . In my
I have a UITableViewCell with 3 checkmark buttons. Each checkmark button is a custom
I have UIButton that I set the background image for three states, normal, highlighted,
In my application I have a UITableView and some buttons that the user can

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.