简体   繁体   中英

Possible to slide down UITabBarController?

I'm sure I've seen code for this somewhere this somewhere, but I can't find it...

I'd like to be able to programatically slide down a UITabBarController... not when transitioning to another view, but within the same view.

If you want to slide the UITabBar down and up you can try something like:

- (IBAction)showHideTabBar:(id)sender {
    static BOOL isShowing = YES;

    CGRect tabBarFrame = self.tabBarController.tabBar.frame;

    if (isShowing) {
        tabBarFrame.origin.y += tabBarFrame.size.height;
    }
    else {
        tabBarFrame.origin.y -= tabBarFrame.size.height;
    }

    isShowing = !isShowing;

    [UIView animateWithDuration:0.3 animations:^ {
        [self.tabBarController.tabBar setFrame:tabBarFrame];
    }];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM