You are viewing the article How to hide and show tab bar and Increase and decrease tableView height? at Lassho.edu.vn you can quickly access the necessary information in the table of contents of the article below.
I have a UITabBarController and I added a view controller. In my UIViewController I have a UITableView.
My requirement is whenever I will scroll down tableView then Tab bar should be hidden and TableView should come at full screen and when I scroll tableView up then TabBar should not be hidden.
Here is my story-board screen shots:
In Images you can see I have taken tableView and tabBar. And also TableView height I have to show full when TabBar will be hidden.
Here is my code:
//Change Tab bar func changeTabBar(hidden:Bool, animated: Bool){ let tabBar = self.tabBarController?.tabBar if tabBar!.isHidden == hidden{ return } let frame = tabBar?.frame let offset = (hidden ? (frame?.size.height)! : -(frame?.size.height)!) let duration:TimeInterval = (animated ? 0.5 : 0.0) tabBar?.isHidden = false if frame != nil { UIView.animate(withDuration: duration, animations: { tabBar!.frame = frame!.offsetBy(dx: 0, dy: offset) //tabBar?.isHidden = true //self.tableView.frame.size.height = self.tableView.frame.size.height + (tabBar?.frame.size.height)! }, completion: { if $0 {tabBar?.isHidden = hidden} }) } } //ScrollView Delegate extension reNewView : UIScrollViewDelegate { //Tab bar func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { if scrollView.panGestureRecognizer.translation(in: scrollView).y < 0{ changeTabBar(hidden: true, animated: true) } else{ changeTabBar(hidden: false, animated: true) } } }
What to do ?
I checked this link also but still not getting proper answer.
Thank you for reading this post How to hide and show tab bar and Increase and decrease tableView height? at Lassho.edu.vn You can comment, see more related articles below and hope to help you with interesting information.
Related Search: