Post

UIKit - navigation push를 통해 화면 전환 시 UITabBar 숨기기

특정 화면에서 tabbar를 숨기기 위해선 아래와 같이 hidesBottomBarWhenPushed 프로퍼티를 통해 처리 가능함.

예시

1
2
3
4
5
6
7
8
9
10
11
extension BookListViewController: UITableViewDataSource, UITableViewDelegate{
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let detailVC = BookDetailViewController()
        detailVC.hidesBottomBarWhenPushed = true
        self.navigationController?.pushViewController(detailVC, animated: true)
    }

    ...

}

tabBarController에서 제공하는 isHidden 프로퍼티는 TabBar 영역은 그대로 유지하지만 hidesBottomBarWhenPushed는 영역도 숨겨줌

결과

image

This post is licensed under CC BY 4.0 by the author.