I have a CollectionView from where I have a modal segue (going fullscreen) to a TabBarController. In the middle of the tabBar from the TabBarController is a UIButton which pushes a modal view above the TabBarController (not fullscreen). After the modal view pushed from the TabBarController got dismissed, the UIButton disappears in the tabBar (as seen in the pictures)
before opening modal view
after dismissal
This does not happen, when the second modally presented ViewController is shown fullscreen. The following setup works fine:
CollectionView --modal fullscreen--> TabBarController --modal fullscreen--> anotherViewController
This also doesn't happen, when I embed the first VC in a NavigationController and push the TabBarController within the navigationstack. This here works also as expected:
NavigationView(CollectionView) --pushes--> TabBarController --modal--> anotherViewController
The problem is only showing, when I present a ViewController modally, not fullscreen, above another modally shown ViewController. And now I want to understand why this is happening.
This is how I set up my TabBar:
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
setupTabBarAppearance()
setupTabBarShadow()
setupTabBar()
}
private func setupTabBar() {
middleButtonView.center = CGPoint(x: tabBar.frame.width / 2, y: 10)
middleButton.center = CGPoint(x: middleButtonView.frame.width / 2, y: middleButtonView.frame.width / 2)
middleButtonView.addSubview(middleButton)
tabBar.addSubview(middleButtonView)
}
This is how I present the ModalViewController:
@objc private func showController() {
let viewController = TableViewController()
viewController.modalPresentationStyle = .automatic
self.present(viewController, animated: true)
}
I dismiss the presented ViewController within the presented Controller:
@objc func dismissController(){
self.dismiss(animated: true, completion: nil)
}
I'm thankful for any help provided