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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:01:47+00:00 2026-06-16T09:01:47+00:00

In the next code there are 2 methods that are called one after the

  • 0

In the next code there are 2 methods that are called one after the other. The first one makes the center button disappear and the second one makes the tabbar disappear. Separately they are working fine.
My problem is that when I try to call them one after the other hideCenterButton doesn’t animate. Instead of rolling to the left of the screen the button just disappears.

-(void)hideCenterButton:(BOOL)animated
{
    if(animated){

        [UIView animateWithDuration:0.3
                              delay:0.0f
                            options:UIViewAnimationCurveLinear
                         animations:^{
                             CGRect frame = self.centerButton.frame;
                             frame.origin.x = -100;
                             self.centerButton.frame = frame;
                         }
                         completion:^(BOOL finished){
                         }];
    }}

…

- (void)hideTabBar:(UITabBarController *) tabbarcontroller
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        //[UIView setAnimationDelay:1];
        for(UIView *view in tabbarcontroller.view.subviews)
        {
            if([view isKindOfClass:[UITabBar class]] || [view isKindOfClass:[UIImageView class]])
            {
                [view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
            }
            else
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
            }
        }

        [UIView commitAnimations];
    }
  • 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-16T09:01:48+00:00Added an answer on June 16, 2026 at 9:01 am

    You have probably hit into some kind of limitation of UIView-based animations. Several things you might try are:

    1. use animateWithDuration also for hideTabBar:: indeed, beginAnimation is the old-way of animating UIView; animateWithDuration is more recent (introduced with iOS4); by using the same animation calls in bot cases you might get better results; this should be straightforward; this should work:

        - (void)hideTabBar:(UITabBarController *) tabbarcontroller
        {
      [UIView animateWithDuration:0.3
                            delay:0.0f
                          options:UIViewAnimationCurveLinear
                       animations:^{
          for(UIView *view in tabbarcontroller.view.subviews)
          {
          if([view isKindOfClass:[UITabBar class]] || [view isKindOfClass:[UIImageView class]])
          {
              [view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
          }
          else
          {
              [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
          }
         }
                       }
                       completion:nil];
      }
      
    2. rewrite your animation using Core Animation: this is a slightly lower-level mechanism but it allows you to get the best results in terms of performance; this is, e.g., how you could rewrite the first animation:

    first you need to provide a callback:

    - (void)animationDidStop:(CABasicAnimation*)anim finished:(BOOL)flag {
           CALayer* layer = [anim valueForKey:@"animationLayer"];
           layer.position = [anim.toValue CGPointValue];
    }
    

    then you can animate your button like this:

        CABasicAnimation* move = [CABasicAnimation animationWithKeyPath:@"position"];
        CGPoint pos = self.centerButton.center;
        pos.x -= 100;
        move.toValue = [NSValue valueWithCGPoint:pos];
        move.duration = 0.3;
        move.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        move.removedOnCompletion = NO;
        move.fillMode = kCAFillModeForwards;
        move.autoreverses = NO;
        move.delegate = self;
        [move setValue:self.centerButton.layer forKey:@"animationLayer"];
        [self.centerButton.layer addAnimation:move forKey:@"buttonPosition"];
    

    Using Core Animation, you will end up writing more code and you will need to allow some time to learn Core Animation basics, but that was the only way I could solve a similar issue I had with two related animation.

    Hope it helps.

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

Sidebar

Related Questions

Is there a way in Entity Framework 4 (using CTP4 and Code First if
I have a class that requires some of its methods to be called in
**the next code should parse a data from a webService to textView; Problem :
The next code runs normally in SQLSERVER but when i change the web.config to
I have next code, <form id=form1 runat=server> <asp:Label runat=server ID=Label1 EnableViewState=false /> <asp:CheckBox runat=server
Someone explain why the next code returns a pointer inside ntdll.dll? GetProcAddress(LoadLibraryA(kernel32.dll), EncodePointer); GetProcAddress(LoadLibraryA(kernel32.dll),
i have written the next code: public void delete(MyType instance) { List<MyType> myList =
Given the next code example, I'm unable to free the parameter const char* expression
I have the next code: class Printer{ Activity activity; public Printer (Activity activity) {
I have the next code : public class AddPrinter extends ListActivity { @Override public

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.