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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:08:03+00:00 2026-06-10T00:08:03+00:00

I am using the code snippet from Tito to add a custom button to

  • 0

I am using the code snippet from Tito to add a custom button to my tab bar:
https://github.com/tciuro/CustomTabBar

(Subclassing UITabbarController and adding a custom button using

// .. created a UIButton *button
[self.view addSubview:button];

)

This works great with my storyboard-based app except for the case of a subview within a navigation controller with the option “Hides bottom bar on push” enabled.
This hides the tab bar as promised, but not the custom button.
Seems like the button should be added as a subview to the tab bar itself?
I tried this ugly code which did not even make the button show up:

for(UIView *view in self.view.subviews)
{
    if([view isKindOfClass:[UITabBar class]])
    {
        [view addSubview:button];
        break;
    }
}

Any ideas?

UPDATE:
My solution:
In my ApplicationDelegate i define the following methods, which i call whenever needed in the viewWillAppear or viewWillDisappear methods:

-(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)showCenterButton:(BOOL)animated
{
    if(animated){

    [UIView animateWithDuration:0.35
                          delay:0.0f
                        options:UIViewAnimationCurveLinear
                     animations:^{
                         CGRect frame = self.centerButton.frame;
                         frame.origin.x = (self.view.superview.frame.size.width / 2) - (self.centerButton.frame.size.width / 2);
                         self.centerButton.frame = frame;
                     }
                     completion:^(BOOL finished){
                     }];
    }
}

I had to set the animation’s duration to 0.35s to get a smooth effect in harmony with the tab bar.

  • 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-10T00:08:04+00:00Added an answer on June 10, 2026 at 12:08 am

    I think there are 2 ways you can got with this.

    1) try to get the button into a view that is above the old top view controller and the tab bar BUT below the new top view controller that is pushed.

    2) animate away the button when the new view controller is pushed.

    The first will require mucking with the iOS proprietary view hierarchy which is undocumented, unsupported and could change anytime.

    The second will be a matter of making the animation appear smooth enough for your user not to notice. It’s not entirely a matter of behaving perfect, just appearing appropriately.

    I would personally recommend an animation of the the button disappearing (animate it’s alpha to 0) and reappearing based on if your view controller that goes over the tab bar is appearing or disappearing.

    The animation for a navigation is (I believe) 0.3 seconds. If the button is in the middle of the tab bar, you’ll likely want it invisible as the animating in view controller reaches it (if not sooner) so something between 0.1 and 0.15 seconds could be used to animate it out.

    Now this does not make the button behave exactly the same as the tab bar, but with the quickness of the transition being so short, it will be unnoticeable really to the user.

    Now just to provide a question for you to ask yourself. Why do you need to push a view controller that overlaps the tab bar? Why is that more desirable/necessary than presenting a modal view controller? If you can strongly argue for it, keep at it and good luck, if it’s not necessary however, you may be able to achieve the experience you want with a modal view controller.

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

Sidebar

Related Questions

I am using the below code snippet to FTP simple text files from a
From the book Groovy and Grails recipes I'm using the following code snippet: String
I am using this code snippet to add KeyDown event handler to any element
FULL CLASS CODE HERE: http://pastebin.com/rdjDGLJS EDIT: Latest code snippet taken from original posters comment
I'm using this code snippet to encrypt/decrypt data in my app's database: http://www.androidsnippets.com/encryptdecrypt-strings It
I'm pulling data from Dynamics AX 2009 from c# using the following code snippet.
I'm using the code snippet below to get user details from a wsdl url
I am deleting all data from the table by using below code snippet NSString
In the tableView:cellForRowAtIndexPath: implementation of my UITableViewController subclass I'm using this code snippet: AlarmPicker
I am using the following code snippet to calculate a total price. This works

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.