Swift 隐藏底部工具栏

class func ww_hideTabBar(_ controller:UIViewController,hidden:Bool) {
        
        UIView.beginAnimations(nil, context: nil)
        UIView.setAnimationDuration(0)
        for view: UIView in controller.tabBarController!.view.subviews {
            if (view is UITabBar) {
                if hidden {
                    view.frame = CGRect(x: view.frame.origin.x, y: WWScreenH, width: view.frame.size.width, height: view.frame.size.height)
                }else {
                    view.frame = CGRect(x: view.frame.origin.x, y: WWScreenH - WWTabHeight, width: view.frame.size.width, height: view.frame.size.height)
                }
                
            }else {
                
                if hidden {
                    view.frame = CGRect(x: view.frame.origin.x, y: view.frame.origin.y, width: view.frame.size.width, height: WWScreenH)
                }else {
                    view.frame = CGRect(x: view.frame.origin.x, y: view.frame.origin.y, width: view.frame.size.width, height: WWScreenH - WWTabHeight)
                }
            }
        }
        UIView.commitAnimations()
    }

你可能感兴趣的:(Swift 隐藏底部工具栏)