📑 학습 내용
- homeVC에서 navigationController로 다른 뷰로 넘어갈 때, 탭 바가 완전히 사라지지 않음 뷰는 나타나지 않지만, 레이아웃은 그대로 유지되는 현상 발생
- tabBarController?.tabBar.isHidden = true 사용시
- ViewController의 hidesBottomBarWhenPushed 속성으로 탭 바를 완전히 숨길 수 있음
- nextVC.hidesBottomBarWhenPushed = true
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
switch collectionView {
case homeView.justDropCollectionView :
let nextVC = DetailViewController()
nextVC.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(nextVC, animated: true)
default:
let nextVC = DetailViewController()
navigationController?.pushViewController(nextVC, animated: true)
}
}
📚 참고 자료
hidesBottomBarWhenPushed | Apple Developer Documentation
A Boolean value indicating whether the toolbar at the bottom of the screen is hidden when the view controller is pushed on to a navigation controller.
developer.apple.com
'Swift' 카테고리의 다른 글
Swift - 카카오 로그인 구현 (1) | 2024.11.13 |
---|---|
Swift - CollectionView - 선택한 셀 UI 변경 (0) | 2024.11.11 |
Swift - UIView 상단에만 테두리(border) 넣기 (0) | 2024.11.04 |
Swift - viewDidLayoutSubviews() (0) | 2024.10.20 |
Swift - UISegmentControl, Content Width 조정 방법 (1) | 2024.10.20 |