OGeek|极客世界-中国程序员成长平台

标题: iphone - 可以滑下UITabBarController吗? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:32
标题: iphone - 可以滑下UITabBarController吗?

我确定我在某个地方看到过此代码,但我找不到它...

我希望能够以编程方式向下滑动 UITabBarController...不是在转换到另一个 View 时,而是在同一个 View 中。



Best Answer-推荐答案


如果您想上下滑动 UITabBar,您可以尝试以下操作:

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

关于iphone - 可以滑下UITabBarController吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4240061/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4