简体   繁体   English

可以滑下UITabBarController吗?

[英]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. 我希望能够以编程方式向下滑动UITabBarController…不是在过渡到另一个视图时而是在同一视图中。

If you want to slide the UITabBar down and up you can try something like: 如果要上下滑动UITabBar ,可以尝试以下操作:

- (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];
    }];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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